agavra commented on code in PR #9806:
URL: https://github.com/apache/pinot/pull/9806#discussion_r1024309759


##########
pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/queries/ResourceBasedQueriesTest.java:
##########
@@ -153,20 +158,56 @@ public void tearDown() {
 
   // TODO: name the test using testCaseName for testng reports
   @Test(dataProvider = "testResourceQueryTestCaseProviderInputOnly")
-  public void testQueryTestCasesWithH2(String testCaseName, String sql)
+  public void testQueryTestCasesWithH2(String testCaseName, String sql, String 
expect)
       throws Exception {
     // query pinot
-    List<Object[]> resultRows = queryRunner(sql);
+    Optional<List<Object[]>> resultRows = runQuery(sql, expect);
+    if (!resultRows.isPresent()) {
+      // successfully caught error
+      return;
+    }
+
     // query H2 for data
     List<Object[]> expectedRows = queryH2(sql);
-    compareRowEquals(resultRows, expectedRows);
+    compareRowEquals(resultRows.get(), expectedRows);
   }
 
   @Test(dataProvider = "testResourceQueryTestCaseProviderBoth")
-  public void testQueryTestCasesWithOutput(String testCaseName, String sql, 
List<Object[]> expectedRows)
+  public void testQueryTestCasesWithOutput(String testCaseName, String sql, 
List<Object[]> expectedRows, String expect)
       throws Exception {
-    List<Object[]> resultRows = queryRunner(sql);
-    compareRowEquals(resultRows, expectedRows);
+    Optional<List<Object[]>> resultRows = runQuery(sql, expect);

Review Comment:
   > IIRC Assert.fail throws AssertionError which is not an Exception so it 
won't be caught in the catch Exception clause.
   
   ah good call!
   
   > this refactoring seems convoluted. can't we simply do:
   
   I can, but then I need to do it twice (once for the h2 compat ones, ones for 
the output checkers)



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to