xuzifu666 commented on code in PR #5208: URL: https://github.com/apache/calcite/pull/5208#discussion_r4052161907
########## core/src/test/resources/sql/agg.iq: ########## @@ -4750,3 +4750,93 @@ order by y; !ok # End agg.iq + +# [CALCITE-6537] Add syntax to allow non-aggregated rows to be used in GROUPING SETS Review Comment: Make sensen, I chose the restricted form. The parser is unchanged (the stack is still needed for grouping constructs nested in GROUPING SETS, e.g. `GROUPING SETS (ROLLUP (deptno, *)))`, but the validator now only expands * in the well-defined positions of the syntax: a complete grouping set (`GROUPING SETS (*)`), an element of a grouping set (`GROUPING SETS ((deptno), (*))`), or an argument of `ROLLUP/CUBE (ROLLUP (deptno, *))`, including the `GROUP BY DISTINCT` wrapper. A star nested inside other expressions, say `GROUPING SETS (ABS(*))`, parses but is not expanded, so validation fails with "Unknown identifier ''", and top-level `GROUP BY *` remains a parse error. ########## core/src/test/java/org/apache/calcite/test/GroupingSetsStarTest.java: ########## @@ -0,0 +1,109 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to you under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.calcite.test; + +import org.apache.calcite.sql.validate.SqlConformanceEnum; +import org.apache.calcite.test.CalciteAssert.Config; + +import org.junit.jupiter.api.Test; + +/** + * Tests for {@code *} as a grouping element in GROUPING SETS, ROLLUP and CUBE, + * yielding non-aggregated (detail) rows. + * + * @see org.apache.calcite.sql.validate.SqlConformance#isGroupingSetsStarAllowed() + */ +class GroupingSetsStarTest { Review Comment: Yes you are right, I had removed the GroupingSetsStarTest. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
