chunweilei commented on a change in pull request #1186: [CALCITE-3003] 
AssertionError when GROUP BY nested field
URL: https://github.com/apache/calcite/pull/1186#discussion_r279630408
 
 

 ##########
 File path: 
core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
 ##########
 @@ -2679,6 +2679,66 @@ public void testSelectNestedColumnType() {
     sql(sql).ok();
   }
 
+  /**
+   * Test case for <a 
href="https://issues.apache.org/jira/browse/CALCITE-3003";>[CALCITE-3003]
+   * AssertionError when GROUP BY nested field</a>.
+   */
+  @Test
+  public void testGroupByNestedColumn() {
+    final String sql =
+        "select\n"
+            + "  coord.x,\n"
+            + "  coord_ne.sub.a,\n"
+            + "  avg(coord.y)\n"
+            + "from\n"
+            + "  customer.contact_peek\n"
+            + "group by\n"
+            + "  coord_ne.sub.a,\n"
+            + "  coord.x";
+    sql(sql).ok();
+  }
+
+  /**
+   * Test case for <a 
href="https://issues.apache.org/jira/browse/CALCITE-3003";>[CALCITE-3003]
+   * AssertionError when GROUP BY nested field</a>.
+   */
+  @Test
+  public void testGroupingSetsWithNestedColumn() {
+    final String sql =
+        "select\n"
+            + "  coord.x,\n"
+            + "  coord.\"unit\",\n"
+            + "  coord_ne.sub.a,\n"
+            + "  avg(coord.y)\n"
+            + "from\n"
+            + "  customer.contact_peek\n"
+            + "group by\n"
+            + "  grouping sets (\n"
+            + "    (coord_ne.sub.a, coord.x, coord.\"unit\"),\n"
+            + "    (coord.x, coord.\"unit\")\n"
+            + "  )";
+    sql(sql).ok();
+  }
+
+  /**
+   * Test case for <a 
href="https://issues.apache.org/jira/browse/CALCITE-3003";>[CALCITE-3003]
+   * AssertionError when GROUP BY nested field</a>.
+   */
+  @Test
 
 Review comment:
   Thanks for your explanation. 
   > There seems to be two conventions in the codebase. One is commenting with 
JIRA link and the other one is using your approach.
   
   Actually there is only one style. Approach of using  `Similar to` is to 
avoid repeating the JIRA case URL when having multiple tests.Please follow 
current style. BTW, we should concisely describe what particular conditions the 
case is targeting instead of using the same description.
   
   > Do you mind if I change my test name to 
testInvalidGroupBy_withInvalidTableName, instead of adding a comment?
   
   I think maybe `testInvalidGroupByWithInvalidTableName` is better. But also 
please leave a comment to help understand what the case is targeting.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to