npawar commented on issue #4962: Create a new query endpoint for sql
URL: 
https://github.com/apache/incubator-pinot/issues/4962#issuecomment-571272652
 
 
   Existing endpoints are:
   1. /query
   GET 
   ```
   @GET
   @Produces(MediaType.APPLICATION_JSON)
   @Path("query")
   public String processQueryGet(
           @ApiParam(value = "Query", required = true) @QueryParam("bql") 
String query,
           @ApiParam(value = "Trace enabled") @QueryParam(TRACE) String 
traceEnabled,
           @ApiParam(value = "Debug options") @QueryParam(DEBUG_OPTIONS) String 
debugOptions) {
   ```
   This is a strictly PQL endpoint. A JsonNode is created in this method, which 
sets the query into a "pql" fieldname. There's no scope yet to add any query 
options, which is necessary for sql
   
   2. /query
   POST
   ```
   @POST
   @Path("query")
   public String processQueryPost(String payload) {
   ```
   This endpoint takes a payload. As a result, this one works for pql as well 
as sql. This one also lets you set the query options for pql.
   
   
   We have 2 options to take it from here to introduce the sql endpoint
   1. Add a completely new set of endpoints for "/sql"
   a) For the GET, this means creating the JsonNode correctly with "sql", and 
setting all the sql options
   b) For the POST, this means validating the payload has "sql". Adding the sql 
query options to the payload.
   
   2. Modify existing endpoints to be able to handle both modes
   a) For the GET, this means adding a new query param, to indicate this is a 
sql/pql query, and then accordingly creating the JsonNode
   b) For the POST, this means checking the payload for sql/pql, and then 
adding the sql query options if sql.
   
   I like option 1. It lets us keep pql and sql as obviously separate 
endpoints, and make the coding clean, avoiding a lot of if else.  

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to