deepthi912 commented on code in PR #16626:
URL: https://github.com/apache/pinot/pull/16626#discussion_r2305194284


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java:
##########
@@ -153,27 +159,66 @@ public StreamingOutput 
handleTimeSeriesQueryRange(@QueryParam("language") String
 
   @POST
   @Path("validateMultiStageQuery")
-  public MultiStageQueryValidationResponse validateMultiStageQuery(String 
requestJsonStr,
+  public MultiStageQueryValidationResponse 
validateMultiStageQuery(MultiStageQueryValidationRequest request,
       @Context HttpHeaders httpHeaders) {
-    JsonNode requestJson;
-    try {
-      requestJson = JsonUtils.stringToJsonNode(requestJsonStr);
-    } catch (Exception e) {
-      LOGGER.warn("Caught exception while parsing request {}", e.getMessage());
-      return new MultiStageQueryValidationResponse(false, "Failed to parse 
request JSON: " + e.getMessage(), null);
-    }
-    if (!requestJson.has("sql")) {
-      return new MultiStageQueryValidationResponse(false, "JSON Payload is 
missing the query string field 'sql'", null);
+
+    if (request.getSql() == null || request.getSql().trim().isEmpty()) {
+      return new MultiStageQueryValidationResponse(false, "Request is missing 
the query string field 'sql'", null);
     }
-    String sqlQuery = requestJson.get("sql").asText();
+
+    String sqlQuery = request.getSql();
     Map<String, String> queryOptionsMap = 
RequestUtils.parseQuery(sqlQuery).getOptions();
     String database = 
DatabaseUtils.extractDatabaseFromQueryRequest(queryOptionsMap, httpHeaders);
-    try (QueryEnvironment.CompiledQuery compiledQuery = new 
QueryEnvironment(database,
-        _pinotHelixResourceManager.getTableCache(), null).compile(sqlQuery)) {
-      return new MultiStageQueryValidationResponse(true, null, null);
+
+    try {
+      TableCache tableCache;
+      if (request.getTableConfigs() != null && 
!request.getTableConfigs().isEmpty() && request.getSchemas() != null
+          && !request.getSchemas().isEmpty()) {
+        List<TableConfig> tableConfigs = new ArrayList<>();

Review Comment:
   Yeah, think I didn't remove this code after modifying the request to a class 
instead of string. Removed



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