Support Grouping functions with Group By CUBE/ROLLUP/GROUPING SETS
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
PostgreSQL, SparkSQL and Oracle support using GROUPING functions to specify the null is from subtotal or from original
data.
https://www.postgresql.org/docs/15/functions-aggregate.html#FUNCTIONS-HYPOTHETICAL-TABLE
Databricks SparkSQL https://docs.databricks.com/sql/language-manual/functions/grouping.html
Oracle https://oracle-base.com/articles/misc/rollup-cube-grouping-functions-and-grouping-sets#grouping
Describe the solution you'd like
Describe alternatives you've considered
Additional context
I'm working on it now.
where is the document of these features?
take
I don't think this works as a aggregate function in the physical plan. It depends on the grouping rather than the data, so the current abstraction doesn't have access to the necessary information.
I think this case (along with GROUPING_ID, any others?) will need special handling in GroupHashedAggregateStream.