apache / datafusion

Apache DataFusion SQL Query Engine
https://datafusion.apache.org/
Apache License 2.0
5.21k stars 957 forks source link

Support user defined display for UDF #10376

Closed jayzhan211 closed 1 week ago

jayzhan211 commented 2 weeks ago

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

  1. Mimic the pattern as Expr::GetIndexedField for #10374
  2. expr[key] looks nicer!

https://github.com/apache/datafusion/blob/8190cb97216e4f46faccbeddae57f6773587955f/datafusion/expr/src/expr.rs#L1583-L1595

Given the current function to build the name has only a fixed pattern, I think enable user-defined display is a good idea

https://github.com/apache/datafusion/blob/8190cb97216e4f46faccbeddae57f6773587955f/datafusion/expr/src/expr.rs#L1646-L1653

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 commented 2 weeks ago

Looks like it doesn't need a lot of changes. Since I worked on another issue related to display_name, I want to take this. :)

yyy1000 commented 2 weeks ago

I'm working on it and I found after https://github.com/apache/datafusion/pull/10325 is merged, it will avoid a conflict. Given it's close to be merged, I think we can wait a moment.