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_r313896014
##########
File path:
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java
##########
@@ -86,24 +115,34 @@ public String post(String requestJsonStr, @Context
HttpHeaders httpHeaders) {
@GET
@Path("pql")
- public String get(@QueryParam("pql") String pqlQuery, @QueryParam("trace")
String traceEnabled,
+ public String getPql(@QueryParam("pql") String pqlQuery,
@QueryParam("trace") String traceEnabled,
@Context HttpHeaders httpHeaders) {
try {
LOGGER.debug("Trace: {}, Running query: {}", traceEnabled, pqlQuery);
- return getQueryResponse(pqlQuery, traceEnabled, httpHeaders);
+ return getQueryResponse(pqlQuery, traceEnabled, httpHeaders, "pql");
} catch (Exception e) {
LOGGER.error("Caught exception while processing get request", e);
return QueryException.getException(QueryException.INTERNAL_ERROR,
e).toString();
}
}
- public String getQueryResponse(String pqlQuery, String traceEnabled,
HttpHeaders httpHeaders) {
+ public String getQueryResponse(String query, String traceEnabled,
+ HttpHeaders httpHeaders, String queryFormat) {
// Get resource table name.
BrokerRequest brokerRequest;
try {
- brokerRequest = REQUEST_COMPILER.compileToBrokerRequest(pqlQuery);
+ switch (queryFormat) {
+ case PQL:
+ brokerRequest = PQL_COMPILER.compileToBrokerRequest(query);
+ break;
+ case SQL:
+ brokerRequest = SQL_COMPILER.compileToBrokerRequest(query);
+ break;
+ default:
+ throw new UnsupportedOperationException("Unknown query format - " +
queryFormat);
Review comment:
If we go the `/pql` and '/sql' route, then this condition never happens.
----------------------------------------------------------------
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]