beliefer opened a new pull request, #37216: URL: https://github.com/apache/spark/pull/37216
### What changes were proposed in this pull request? Many mainstream database supports aggregate function `MODE`. **Syntax**: Aggregate function `MODE( <expr1> )` Window function `MODE( <expr1> ) OVER ( [ PARTITION BY <expr2> ] )` **Arguments**: expr1: This expression produces the values that are searched to find the most frequent value. The expression can be of any of the following data types: BINARY BOOLEAN DATE FLOAT INTEGER NUMBER TIMESTAMP (TIMESTAMP_LTZ, TIMESTAMP_NTZ, TIMESTAMP_TZ) STRING expr2: The optional expression on which to partition the data into groups. The output contains the most frequent value for each group/partition. **Examples**: ``` select k, mode(v) from aggr group by k order by k; +---+---------+ | K | MODE(V) | |---+---------| | 1 | 10.00 | | 2 | 20.00 | | 3 | NULL | +---+---------+ ``` ### Why are the changes needed? The mainstream database supports `MODE` show below: **Snowflake** https://docs.snowflake.com/en/sql-reference/functions/mode.html ### Does this PR introduce _any_ user-facing change? 'No'. New feature. ### How was this patch tested? New test cases. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
