datafusion icon indicating copy to clipboard operation
datafusion copied to clipboard

[built-in function] add `greatest(T,...)` and `least(T,...)` SQL functions

Open jimexist opened this issue 2 years ago • 4 comments

Which issue does this PR close?

  • Closes #6531

Rationale for this change

add greatest(T,..) and least(T,..) variadic functions as per SQL 2023.

What changes are included in this PR?

  • add greatest(T,..) and least(T,..) variadic functions as per SQL 2023.
    • when no args are supplied the functions err
    • when both scalar and arrays are supplied then scalars are converted to arrays before max/min
    • only boolean, string, and numeric types are supported for now, no dates, etc.
    • arrow zip and ord kernels are used
  • change variadic equal function signature to take a vec of allowed types, only types within that types can be used

Are these changes tested?

  • unit tests
  • integration tests using tokio and based on sql

Are there any user-facing changes?

jimexist avatar Jun 02 '23 07:06 jimexist

Marking as draft as this PR has feedback and is awaiting a response (I am trying to keep the list of PRs needing review clear) -- please mark as ready for review when ready

alamb avatar Jun 09 '23 13:06 alamb

Welcome back 👋 @Jimexist ! It is great to see you again and thank you for your contribution.

I am sorry I wrote a comment about using Min and Max accumulators previously but I forgot to click submit.

cc @izveigor as I think you have been working to add additional support for array computations

thank you @alamb my bandwidth recently is very limited, so I am going to pause this PR for a bit, if anyone wants to take over feel free to. I can also do a merge as is (after rebase fix) and create issues as follow ups?

jimexist avatar Jun 12 '23 07:06 jimexist

thank you @alamb my bandwidth recently is very limited, so I am going to pause this PR for a bit, if anyone wants to take over feel free to. I can also do a merge as is (after rebase fix) and create issues as follow ups?

Whatever you prefer -- I defer to your judgement

alamb avatar Jun 12 '23 17:06 alamb

Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar May 07 '24 01:05 github-actions[bot]