Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dharanad committed Aug 30, 2024
1 parent c32fedb commit 0b342a4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions datafusion/functions-nested/src/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use datafusion_expr::{
planner::{ExprPlanner, PlannerResult, RawBinaryExpr, RawFieldAccessExpr},
sqlparser, Expr, ExprSchemable, GetFieldAccess,
};
use datafusion_functions::expr_fn::{get_field, get_field_helper};
use datafusion_functions::expr_fn::{get_field, _get_field};
use datafusion_functions_aggregate::nth_value::nth_value_udaf;

use crate::map::map_udf;
Expand Down Expand Up @@ -150,7 +150,7 @@ impl ExprPlanner for FieldAccessPlanner {
match expr {
// Special case for accessing map value with non-string values
Expr::ScalarFunction(scalar_func) if is_map(&scalar_func) => {
Ok(PlannerResult::Planned(get_field_helper(
Ok(PlannerResult::Planned(_get_field(
Expr::ScalarFunction(scalar_func),
*index,
)))
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions/src/core/getfield.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl ScalarUDFImpl for GetFieldFunc {
}
};

let key_scalar = Scalar::new(key_array.clone());
let key_scalar = Scalar::new(key_array);
let keys = arrow::compute::kernels::cmp::eq(&key_scalar, map_array.keys())?;

// note that this array has more entries than the expected output/input size
Expand Down
5 changes: 3 additions & 2 deletions datafusion/functions/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ pub mod expr_fn {
super::get_field().call(vec![arg1, arg2.lit()])
}

// FIXME: This is a helper function to support a use case for map
pub fn get_field_helper(arg1: Expr, arg2: Expr) -> Expr {
/// Returns the value of the field with the given name from the struct.
/// **Internal use only.** This function is added to support the map use case.
pub fn _get_field(arg1: Expr, arg2: Expr) -> Expr {
super::get_field().call(vec![arg1, arg2])
}
}
Expand Down

0 comments on commit 0b342a4

Please sign in to comment.