数据湖探索 DLI-ROLLUP:关键字

时间:2024-07-01 21:07:21

关键字

ROLLUP:为GROUP BY的扩展,例如:SELECT a, b, c, SUM(expression) FROM table GROUP BY a, b, c WITH ROLLUP;将转换成以下四条查询:
  • (a, b, c)组合小计
    1
    2
    SELECT a, b, c, sum(expression) FROM table
      GROUP BY a, b, c;
    
  • (a, b)组合小计
    1
    2
    SELECT a, b, NULL, sum(expression) FROM table
      GROUP BY a, b;
    
  • (a)组合小计
    1
    2
    SELECT a, NULL, NULL, sum(expression) FROM table
      GROUP BY a;
    
  • 总计
    1
    SELECT NULL, NULL, NULL, sum(expression) FROM table;
    
support.huaweicloud.com/sqlreference-dli/dli_08_0163.html