-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem or challenge?
The feature request is based on the need that I would like get_field(expr, key) to displayed as expr[key].
two reason
- Mimic the pattern as Expr::GetIndexedField for Remove
Expr::GetIndexedFieldandGetFieldAccessand always use functionget_fieldfor indexing #10374 expr[key]looks nicer!
datafusion/datafusion/expr/src/expr.rs
Lines 1583 to 1595 in 8190cb9
| Expr::GetIndexedField(GetIndexedField { field, expr }) => match field { | |
| GetFieldAccess::NamedStructField { name } => { | |
| write!(f, "({expr})[{name}]") | |
| } | |
| GetFieldAccess::ListIndex { key } => write!(f, "({expr})[{key}]"), | |
| GetFieldAccess::ListRange { | |
| start, | |
| stop, | |
| stride, | |
| } => { | |
| write!(f, "({expr})[{start}:{stop}:{stride}]") | |
| } | |
| }, |
Given the current function to build the name has only a fixed pattern, I think enable user-defined display is a good idea
datafusion/datafusion/expr/src/expr.rs
Lines 1646 to 1653 in 8190cb9
| fn create_function_name(fun: &str, distinct: bool, args: &[Expr]) -> Result<String> { | |
| let names: Vec<String> = args.iter().map(create_name).collect::<Result<_>>()?; | |
| let distinct_str = match distinct { | |
| true => "DISTINCT ", | |
| false => "", | |
| }; | |
| Ok(format!("{}({}{})", fun, distinct_str, names.join(","))) | |
| } |
Describe the solution you'd like
No response
Adding display_name to ScalarUDFImpl
Describe alternatives you've considered
No response
Additional context
No response
yyy1000
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request