Background: we are building a platform that adopts Calcite to process (i.e., parse&validate&convert&optimize) SQL queries and then regenerate the final SQL. For the purpose of handling large volume data, we use the popular SparkSQL engine to execute the generated SQL query.
However, we found a great part of real-world test cases failed, due to syntax differences of
CUBE/ROLLUP/GROUPING SETS clauses. Spark SQL dialect supports only "WITH ROLLUP&CUBE" in the "GROUP BY" clause. The corresponding grammer  is defined as below.
To fill this gap, I think we need to rewrite CUBE/ROLLUP/GROUPING SETS clauses in SparkSqlDialect, especially for some complex cases.