GROUPING (Lakehouse v2)
Indica se uma coluna especificada em uma cláusula GROUP BY está agregada. Retorna 1 se estiver agregada e 0 caso contrário.
Sintaxe no Analyze
Seção intitulada “Sintaxe no Analyze”func.grouping(get_column(table, 'department'))Exemplos no Analyze
Seção intitulada “Exemplos no Analyze”func.grouping(get_column(table, 'department'))Sintaxe SQL
Seção intitulada “Sintaxe SQL”GROUPING(<department>)Exemplos de SQL
Seção intitulada “Exemplos de SQL”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 │└────────────┴───────────────────────┴─────────────┘