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


##########
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/MultiStageEngineIntegrationTest.java:
##########
@@ -1684,6 +1682,31 @@ public void testPolymorphicScalarArrayFunctions() throws 
Exception {
     
assertEquals(jsonNode.get("resultTable").get("rows").get(0).get(0).asInt(), 2);
   }
 
+  @Test
+  public void testValidateQueryApi()
+      throws Exception {
+    JsonNode result = JsonUtils.stringToJsonNode(
+        sendPostRequest(getControllerBaseApiUrl() + "/validateMultiStageQuery",
+            "{\"sql\": \"SELECT invalidColumn FROM invalidTable\"}", null));
+    assertFalse(result.get("compiledSuccessfully").asBoolean());
+    assertEquals(result.get("errorCode").asText(), 
QueryErrorCode.TABLE_DOES_NOT_EXIST.name());
+    assertFalse(result.get("errorMessage").isNull());
+
+    result = JsonUtils.stringToJsonNode(
+        sendPostRequest(getControllerBaseApiUrl() + "/validateMultiStageQuery",
+            "{\"sql\": \"SELECT * FROM mytable\"}", null));
+    assertTrue(result.get("compiledSuccessfully").asBoolean());
+    assertTrue(result.get("errorCode").isNull());
+    assertTrue(result.get("errorMessage").isNull());
+
+    result = JsonUtils.stringToJsonNode(
+        sendPostRequest(getControllerBaseApiUrl() + "/validateMultiStageQuery",
+            "{\"sql\": \"SELECT CAST('abc' AS INT)\"}", null));
+    assertFalse(result.get("compiledSuccessfully").asBoolean());
+    assertEquals(result.get("errorCode").asText(), 
QueryErrorCode.QUERY_PLANNING.name());
+    assertFalse(result.get("errorMessage").isNull());
+  }
+

Review Comment:
   Can we have a single test for each case?



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