gortiz commented on code in PR #13664:
URL: https://github.com/apache/pinot/pull/13664#discussion_r1684467779


##########
pinot-query-planner/src/test/java/org/apache/pinot/query/QueryCompilationTest.java:
##########
@@ -385,10 +385,15 @@ public void testGetTableNamesForQuery() {
     assertEquals(tableNames.get(0), "a");
   }
 
-  @Test(expectedExceptions = RuntimeException.class)
+  @Test
   public void testDuplicateWithAlias() {
     String query = "WITH tmp AS (SELECT * FROM a LIMIT 1), tmp AS (SELECT * 
FROM a LIMIT 2) SELECT * FROM tmp";
-    _queryEnvironment.getTableNamesForQuery(query);
+    try {
+      _queryEnvironment.getTableNamesForQuery(query);
+      fail("Expected compilation of query with duplicate CTE alias to throw an 
exception");
+    } catch (RuntimeException e) {
+      assertTrue(e.getCause().getMessage().contains("Duplicate alias in WITH: 
'tmp'"));
+    }

Review Comment:
   nit: You can use `@Test(expectedExceptionsMessageRegExp = "regexp")` which 
will give you a better error message



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