apache / datafusion

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

Add `greatest(T,...)` and `least(T,...)` SQL functions #6531

Open jimexist opened 1 year ago

jimexist commented 1 year ago

Is your feature request related to a problem or challenge?

a challenge to implement greatest and least SQL functions

Describe the solution you'd like

Similar to the 2023 standard

Describe alternatives you've considered

using if else but it is very cumbersome

Additional context

No response

waynexia commented 2 weeks ago

I'd like to continue this task if you don't mind. AFAIK there isn't an obvious blocker from the history of #6527 by @jimexist and #12474 by @rluvaton.

For the topic in #12357 by @alamb, given greatest and least are both supported by PG and in the spec, adding them to the built-in function list makes sense to me.

rluvaton commented 2 weeks ago

I reopened my pr, can you please review my code there before I add tests?

waynexia commented 2 weeks ago

Thank you @rluvaton, from the aspect of progress, I'd personally prefer to continue on #6527. But it's good that you are willing to drive your work. I've skimmed both #6527 and #12474 and both LGTM so far. Feel free to pin me after #12474 is ready for review.

alamb commented 1 week ago

Upate is that @rluvaton added support for greatest in

Perhaps we should file a separate ticket for least 🤔

rluvaton commented 1 week ago

I'll try to add the least function in the coming week