mayankshriv commented on a change in pull request #4519: Add support sql query 
http api
URL: https://github.com/apache/incubator-pinot/pull/4519#discussion_r313895194
 
 

 ##########
 File path: 
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java
 ##########
 @@ -66,8 +72,31 @@
   @Inject
   AccessControlFactory _accessControlFactory;
 
+  @POST
+  @Path("queryByFormat")
+  public String postQuery(String requestJsonStr, @Context HttpHeaders 
httpHeaders) {
+    try {
+      JsonNode requestJson = JsonUtils.stringToJsonNode(requestJsonStr);
+      String query = requestJson.get("query").asText();
+      String traceEnabled = "false";
+      if (requestJson.has("trace")) {
+        traceEnabled = requestJson.get("trace").toString();
+      }
+      String queryFormat = "pql";
+      if (requestJson.has("queryFormat")) {
+        queryFormat = requestJson.get("queryFormat").asText();
+      }
+      LOGGER.debug("Trace: {}, Running query: {}", traceEnabled, query);
+      return getQueryResponse(query, traceEnabled, httpHeaders, queryFormat);
+    } catch (Exception e) {
+      LOGGER.error("Caught exception while processing post request", e);
+      return QueryException.getException(QueryException.INTERNAL_ERROR, 
e).toString();
+    }
+  }
+
   @POST
   @Path("pql")
+  @Deprecated
 
 Review comment:
   Another backward compatible way of making this change is to keep "pql" path 
for PQL queries 'as-is' and add a "sql" path for SQL queries. Unclear to me 
which is a better option at the moment, but stating so that others can also 
pitch in. At least, in this approach there is no need to deprecate existing api.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to