apache / datafusion

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

Avoid cloning when simplifying expressions for Log, Power UDF #10003

Closed tinfoil-knight closed 7 months ago

tinfoil-knight commented 7 months ago

Is your feature request related to a problem or challenge?

@alamb pointed this out while reviewing #9983

https://github.com/apache/arrow-datafusion/blob/ad0abe91752b8da327e97b09d8ca883c782f027d/datafusion/functions/src/math/log.rs#L179

It would be really nice to avoid this clone (I am working to reduce the number of times we need to clone Exprs during planning). see https://github.com/tinfoil-knight/arrow-datafusion/pull/1 for a suggestion

See https://github.com/apache/arrow-datafusion/pull/9983#discussion_r1556233198

Describe the solution you'd like

Avoid using .clone() wherever possible

Describe alternatives you've considered

No response

Additional context

No response

tinfoil-knight commented 7 months ago

take

alamb commented 7 months ago

I polished up some code I had and put it up as https://github.com/apache/arrow-datafusion/pull/10086