[SPARK-45904][SQL][CONNECT] Mode function should supports sort with order direction#43786
[SPARK-45904][SQL][CONNECT] Mode function should supports sort with order direction#43786beliefer wants to merge 1 commit intoapache:masterfrom
Conversation
There was a problem hiding this comment.
I think it's not worth let isSortAsc as the child expression of Mode due to it's always none or foldable.
0976ecc to
ae2bb7e
Compare
ae2bb7e to
1b3f94f
Compare
1b3f94f to
66db030
Compare
|
Actually this is literally the same implementation I came up with internally before I added deterministic mode in #42755. But then we reduced the sort argument ( @beliefer, are you referring to the cc @cloud-fan, @srielau |
Because I want add the new I found that the current implementation of |
|
ping @MaxGekk cc @cloud-fan |
|
The GA failure is unrelated. |
| * @since 4.0.0 | ||
| */ | ||
| def mode(e: Column, deterministic: Boolean): Column = Column.fn("mode", e, lit(deterministic)) | ||
| def mode(e: Column, isSortAsc: Boolean): Column = Column.fn("mode", e, lit(isSortAsc)) |
There was a problem hiding this comment.
If we do want to support specify ordering, we should support ordering columns. I don't agree with this partial API change. Let's finish the SQL side first, then we can think about how the Scala API should look like.
|
I will close due to #44184 merged. |
What changes were proposed in this pull request?
Currently, the mode aggregate function only support sort desc with the input column.
But the mainstream database (e.g. H2 and Postgres) supports sort desc or asc.
#43663 will support
MODE() WITHIN GROUP (ORDER BY col [ASC|DESC])syntax.Why are the changes needed?
Mode function should supports sort with order direction.
Does this PR introduce any user-facing change?
'No'.
New feature.
How was this patch tested?
Test cases updated.
Was this patch authored or co-authored using generative AI tooling?
'No'.