tibrewalpratik17 commented on code in PR #13792:
URL: https://github.com/apache/pinot/pull/13792#discussion_r1717149466


##########
pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java:
##########
@@ -2592,18 +2592,40 @@ public void testNonAggregationGroupByQuery() {
         5);
   }
 
+  @Test
+  public void testNonAggregationGroupByQueryNoRewrites() {
+    String query = "SELECT col1 FROM foo GROUP BY col1, col2";
+    PinotQuery pinotQuery = compileToPinotQuery(query);
+    Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
+    Assert.assertEquals(
+        pinotQuery.getSelectList().get(0).getIdentifier().getName(), "col1");
+    Assert.assertEquals(
+        pinotQuery.getGroupByList().get(0).getIdentifier().getName(), "col1");
+    Assert.assertEquals(
+        pinotQuery.getGroupByList().get(1).getIdentifier().getName(), "col2");
+
+    query = "SELECT col1+col2 FROM foo GROUP BY col1,col2";
+    pinotQuery = compileToPinotQuery(query);
+    Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
+    Assert.assertEquals(
+        pinotQuery.getSelectList().get(0).getFunctionCall().getOperator(),
+        "plus");
+    Assert.assertEquals(
+        
pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(),
 "col1");
+    Assert.assertEquals(
+        
pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(),
 "col2");
+  }
+
   @Test
   public void testInvalidNonAggregationGroupBy() {
-    Assert.assertThrows(SqlCompilationException.class,
-        () -> compileToPinotQuery("SELECT col1 FROM foo GROUP BY col1, col2"));
     Assert.assertThrows(SqlCompilationException.class,
         () -> compileToPinotQuery("SELECT col1, col2 FROM foo GROUP BY col1"));
     Assert.assertThrows(SqlCompilationException.class,
         () -> compileToPinotQuery("SELECT col1 + col2 FROM foo GROUP BY 
col1"));
-    Assert.assertThrows(SqlCompilationException.class,
-        () -> compileToPinotQuery("SELECT col1+col2 FROM foo GROUP BY 
col1,col2"));
   }
 
+
+

Review Comment:
   nit: remove extra lines



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to