GROUPING (Lakehouse v2)
Indicates whether a specified column in a GROUP BY clause is aggregated. Returns 1 if aggregated, 0 otherwise.
Analyze Syntax
Section titled “Analyze Syntax”func.grouping(get_column(table, 'department'))Analyze Examples
Section titled “Analyze Examples”func.grouping(get_column(table, 'department'))SQL Syntax
Section titled “SQL Syntax”GROUPING(<department>)SQL Examples
Section titled “SQL Examples”SELECT department, GROUPING(department), SUM(salary)FROM employees GROUP BY ROLLUP(department);
┌────────────┬───────────────────────┬─────────────┐│ department │ grouping(department) │ sum(salary) │├────────────┼───────────────────────┼─────────────┤│ Sales │ 0 │ 195000 ││ IT │ 0 │ 246000 ││ NULL │ 1 │ 441000 │└────────────┴───────────────────────┴─────────────┘