You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/01/07 17:58:50 UTC

[GitHub] [incubator-pinot] npawar opened a new pull request #4964: Sql query endpoint

npawar opened a new pull request #4964: Sql query endpoint
URL: https://github.com/apache/incubator-pinot/pull/4964
 
 
   https://github.com/apache/incubator-pinot/issues/4962

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


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] siddharthteotia commented on a change in pull request #4964: Sql query endpoint

Posted by GitBox <gi...@apache.org>.
siddharthteotia commented on a change in pull request #4964: Sql query endpoint
URL: https://github.com/apache/incubator-pinot/pull/4964#discussion_r364859194
 
 

 ##########
 File path: pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
 ##########
 @@ -67,9 +67,16 @@ public BrokerResponse executeQuery(String brokerAddress, String query)
   public Future<BrokerResponse> executePinotQueryAsync(String brokerAddress, final Request request) {
     try {
       ObjectNode json = JsonNodeFactory.instance.objectNode();
-      json.put(request.getQueryFormat(), request.getQuery());
-
-      final String url = "http://" + brokerAddress + "/query";
+      String queryFormat = request.getQueryFormat();
+      json.put(queryFormat, request.getQuery());
+
+      final String url;
+      if (queryFormat.equalsIgnoreCase("sql")) {
 
 Review comment:
   I feel this is not very intuitive as to why the url path has /query for PQL query format and /sql for SQL query format. May be both modes can have query prefix? I don't think we can change the current url format as that would be backward incompatible but for the SQL format, I think we should consider having /query/sql

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


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] npawar commented on a change in pull request #4964: Sql query endpoint

Posted by GitBox <gi...@apache.org>.
npawar commented on a change in pull request #4964: Sql query endpoint
URL: https://github.com/apache/incubator-pinot/pull/4964#discussion_r364505736
 
 

 ##########
 File path: pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/ResultTableResultSet.java
 ##########
 @@ -0,0 +1,106 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+
+/**
+ * ResultSet which contains the ResultTable from the broker response of a sql query.
+ */
+class ResultTableResultSet extends AbstractResultSet {
+  private JsonNode _rowsArray;
+  private JsonNode _columnNamesArray;
+  private JsonNode _columnDataTypesArray;
 
 Review comment:
   I feel this is okay as is, because:
   The purpose of these ResultSets is to get the fields. For a user using the pinot client, once the ResultTable gets wrapped into ResultSet, the ResultSet will be used directly for accessing data. It will not really be converted to other forms further. So this is just internal representation.
   
   For metadata, this is easy to change later. That will only be necessary when more APIs are added to the ResultSet. The current set of APIs are answered fine with this structure.
   
   Lmk if you think it's okay. 

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


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] mayankshriv commented on a change in pull request #4964: Sql query endpoint

Posted by GitBox <gi...@apache.org>.
mayankshriv commented on a change in pull request #4964: Sql query endpoint
URL: https://github.com/apache/incubator-pinot/pull/4964#discussion_r364406813
 
 

 ##########
 File path: pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/ResultTableResultSet.java
 ##########
 @@ -0,0 +1,106 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+
+/**
+ * ResultSet which contains the ResultTable from the broker response of a sql query.
+ */
+class ResultTableResultSet extends AbstractResultSet {
+  private JsonNode _rowsArray;
+  private JsonNode _columnNamesArray;
+  private JsonNode _columnDataTypesArray;
 
 Review comment:
   Can we replace name and type with schema, and schema can be within metadata field. This way, we can add more metadata as needed.

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


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] siddharthteotia commented on a change in pull request #4964: Sql query endpoint

Posted by GitBox <gi...@apache.org>.
siddharthteotia commented on a change in pull request #4964: Sql query endpoint
URL: https://github.com/apache/incubator-pinot/pull/4964#discussion_r364862501
 
 

 ##########
 File path: pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/ResultTableResultSet.java
 ##########
 @@ -0,0 +1,106 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+
+/**
+ * ResultSet which contains the ResultTable from the broker response of a sql query.
+ */
+class ResultTableResultSet extends AbstractResultSet {
+  private JsonNode _rowsArray;
 
 Review comment:
   (nit): should be final

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


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] siddharthteotia commented on a change in pull request #4964: Sql query endpoint

Posted by GitBox <gi...@apache.org>.
siddharthteotia commented on a change in pull request #4964: Sql query endpoint
URL: https://github.com/apache/incubator-pinot/pull/4964#discussion_r364859194
 
 

 ##########
 File path: pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
 ##########
 @@ -67,9 +67,16 @@ public BrokerResponse executeQuery(String brokerAddress, String query)
   public Future<BrokerResponse> executePinotQueryAsync(String brokerAddress, final Request request) {
     try {
       ObjectNode json = JsonNodeFactory.instance.objectNode();
-      json.put(request.getQueryFormat(), request.getQuery());
-
-      final String url = "http://" + brokerAddress + "/query";
+      String queryFormat = request.getQueryFormat();
+      json.put(queryFormat, request.getQuery());
+
+      final String url;
+      if (queryFormat.equalsIgnoreCase("sql")) {
 
 Review comment:
   I feel this is not very intuitive as to why the url path has /query for PQL query format and /sql for SQL query format. May be both modes can have query prefix? I don't think we can change the current url format as that would be backward compatible but for the SQL format, I think we should consider having /query/sql

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


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] mayankshriv commented on a change in pull request #4964: Sql query endpoint

Posted by GitBox <gi...@apache.org>.
mayankshriv commented on a change in pull request #4964: Sql query endpoint
URL: https://github.com/apache/incubator-pinot/pull/4964#discussion_r363878504
 
 

 ##########
 File path: pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotClientRequest.java
 ##########
 @@ -103,4 +100,60 @@ public String processQueryPost(String query) {
       throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
     }
   }
+
+  @GET
+  @Produces(MediaType.APPLICATION_JSON)
+  @Path("sql")
+  @ApiOperation(value = "Querying pinot in sql")
 
 Review comment:
   Nit: s/in/using?

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


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] siddharthteotia commented on issue #4964: Sql query endpoint

Posted by GitBox <gi...@apache.org>.
siddharthteotia commented on issue #4964: Sql query endpoint
URL: https://github.com/apache/incubator-pinot/pull/4964#issuecomment-572718080
 
 
   LGTM

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


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] npawar merged pull request #4964: Sql query endpoint

Posted by GitBox <gi...@apache.org>.
npawar merged pull request #4964: Sql query endpoint
URL: https://github.com/apache/incubator-pinot/pull/4964
 
 
   

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


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] npawar commented on a change in pull request #4964: Sql query endpoint

Posted by GitBox <gi...@apache.org>.
npawar commented on a change in pull request #4964: Sql query endpoint
URL: https://github.com/apache/incubator-pinot/pull/4964#discussion_r364913062
 
 

 ##########
 File path: pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
 ##########
 @@ -67,9 +67,16 @@ public BrokerResponse executeQuery(String brokerAddress, String query)
   public Future<BrokerResponse> executePinotQueryAsync(String brokerAddress, final Request request) {
     try {
       ObjectNode json = JsonNodeFactory.instance.objectNode();
-      json.put(request.getQueryFormat(), request.getQuery());
-
-      final String url = "http://" + brokerAddress + "/query";
+      String queryFormat = request.getQueryFormat();
+      json.put(queryFormat, request.getQuery());
+
+      final String url;
+      if (queryFormat.equalsIgnoreCase("sql")) {
 
 Review comment:
   changed thi to /query/sql

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


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] jackjlli commented on a change in pull request #4964: Sql query endpoint

Posted by GitBox <gi...@apache.org>.
jackjlli commented on a change in pull request #4964: Sql query endpoint
URL: https://github.com/apache/incubator-pinot/pull/4964#discussion_r363910729
 
 

 ##########
 File path: pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotClientRequest.java
 ##########
 @@ -103,4 +100,60 @@ public String processQueryPost(String query) {
       throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
     }
   }
+
+  @GET
+  @Produces(MediaType.APPLICATION_JSON)
+  @Path("sql")
+  @ApiOperation(value = "Querying pinot in sql")
+  @ApiResponses(value = {@ApiResponse(code = 200, message = "Query response"), @ApiResponse(code = 500, message = "Internal Server Error")})
+  public String processSqlQueryGet(@ApiParam(value = "Query", required = true) @QueryParam("sql") String query,
+      @ApiParam(value = "Trace enabled") @QueryParam(Request.TRACE) String traceEnabled,
+      @ApiParam(value = "Debug options") @QueryParam(Request.DEBUG_OPTIONS) String debugOptions) {
+    try {
+      ObjectNode requestJson = JsonUtils.newObjectNode();
+      requestJson.put(Request.SQL, query);
+      String queryOptions = constructSqlQueryOptions();
+      requestJson.put(Request.QUERY_OPTIONS, queryOptions);
+      if (traceEnabled != null) {
+        requestJson.put(Request.TRACE, traceEnabled);
+      }
+      if (debugOptions != null) {
+        requestJson.put(Request.DEBUG_OPTIONS, debugOptions);
+      }
+      BrokerResponse brokerResponse = requestHandler.handleRequest(requestJson, null, new RequestStatistics());
+      return brokerResponse.toJsonString();
+    } catch (Exception e) {
+      LOGGER.error("Caught exception while processing GET request", e);
+      brokerMetrics.addMeteredGlobalValue(BrokerMeter.UNCAUGHT_GET_EXCEPTIONS, 1L);
+      throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
+    }
+  }
+
+  @POST
+  @Produces(MediaType.APPLICATION_JSON)
+  @Path("sql")
+  @ApiOperation(value = "Querying pinot")
+  @ApiResponses(value = {@ApiResponse(code = 200, message = "Query response"), @ApiResponse(code = 500, message = "Internal Server Error")})
+  public String processSqlQueryPost(String query) {
 
 Review comment:
   Why not contain trace and debug_option in this endpoint?

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


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] npawar commented on issue #4964: Sql query endpoint

Posted by GitBox <gi...@apache.org>.
npawar commented on issue #4964: Sql query endpoint
URL: https://github.com/apache/incubator-pinot/pull/4964#issuecomment-571862726
 
 
   > Could you add a test as well?
   
   Modified existing `testHardcodedSql` method in our integration tests, to start using the new endpoint.
   It contains a very basic query set as of now. I've added TODO to complete that. It can be enriched as and when we start testing the new endpoint and certifying queries.

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


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] npawar commented on a change in pull request #4964: Sql query endpoint

Posted by GitBox <gi...@apache.org>.
npawar commented on a change in pull request #4964: Sql query endpoint
URL: https://github.com/apache/incubator-pinot/pull/4964#discussion_r363963389
 
 

 ##########
 File path: pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotClientRequest.java
 ##########
 @@ -103,4 +100,60 @@ public String processQueryPost(String query) {
       throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
     }
   }
+
+  @GET
+  @Produces(MediaType.APPLICATION_JSON)
+  @Path("sql")
+  @ApiOperation(value = "Querying pinot in sql")
+  @ApiResponses(value = {@ApiResponse(code = 200, message = "Query response"), @ApiResponse(code = 500, message = "Internal Server Error")})
+  public String processSqlQueryGet(@ApiParam(value = "Query", required = true) @QueryParam("sql") String query,
+      @ApiParam(value = "Trace enabled") @QueryParam(Request.TRACE) String traceEnabled,
+      @ApiParam(value = "Debug options") @QueryParam(Request.DEBUG_OPTIONS) String debugOptions) {
+    try {
+      ObjectNode requestJson = JsonUtils.newObjectNode();
+      requestJson.put(Request.SQL, query);
+      String queryOptions = constructSqlQueryOptions();
+      requestJson.put(Request.QUERY_OPTIONS, queryOptions);
+      if (traceEnabled != null) {
+        requestJson.put(Request.TRACE, traceEnabled);
+      }
+      if (debugOptions != null) {
+        requestJson.put(Request.DEBUG_OPTIONS, debugOptions);
+      }
+      BrokerResponse brokerResponse = requestHandler.handleRequest(requestJson, null, new RequestStatistics());
+      return brokerResponse.toJsonString();
+    } catch (Exception e) {
+      LOGGER.error("Caught exception while processing GET request", e);
+      brokerMetrics.addMeteredGlobalValue(BrokerMeter.UNCAUGHT_GET_EXCEPTIONS, 1L);
+      throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
+    }
+  }
+
+  @POST
+  @Produces(MediaType.APPLICATION_JSON)
+  @Path("sql")
+  @ApiOperation(value = "Querying pinot")
+  @ApiResponses(value = {@ApiResponse(code = 200, message = "Query response"), @ApiResponse(code = 500, message = "Internal Server Error")})
+  public String processSqlQueryPost(String query) {
 
 Review comment:
   Everything is part of the payload in this one

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


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] codecov-io commented on issue #4964: Sql query endpoint

Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #4964: Sql query endpoint
URL: https://github.com/apache/incubator-pinot/pull/4964#issuecomment-571715802
 
 
   # [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/4964?src=pr&el=h1) Report
   > Merging [#4964](https://codecov.io/gh/apache/incubator-pinot/pull/4964?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-pinot/commit/247af5d600ed806e3a1088ee8500e3596483e62a?src=pr&el=desc) will **increase** coverage by `21.17%`.
   > The diff coverage is `0%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-pinot/pull/4964/graphs/tree.svg?width=650&token=4ibza2ugkz&height=150&src=pr)](https://codecov.io/gh/apache/incubator-pinot/pull/4964?src=pr&el=tree)
   
   ```diff
   @@              Coverage Diff              @@
   ##             master    #4964       +/-   ##
   =============================================
   + Coverage     36.31%   57.48%   +21.17%     
   - Complexity        0       12       +12     
   =============================================
     Files          1159     1159               
     Lines         61837    61863       +26     
     Branches       9118     9121        +3     
   =============================================
   + Hits          22454    35565    +13111     
   + Misses        37375    23636    -13739     
   - Partials       2008     2662      +654
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-pinot/pull/4964?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...pinot/broker/api/resources/PinotClientRequest.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvYXBpL3Jlc291cmNlcy9QaW5vdENsaWVudFJlcXVlc3QuamF2YQ==) | `10.63% <0%> (-32.22%)` | `0 <0> (ø)` | |
   | [.../org/apache/pinot/client/PinotClientException.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L1Bpbm90Q2xpZW50RXhjZXB0aW9uLmphdmE=) | `33.33% <0%> (-33.34%)` | `0% <0%> (ø)` | |
   | [.../impl/dictionary/FloatOnHeapMutableDictionary.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9yZWFsdGltZS9pbXBsL2RpY3Rpb25hcnkvRmxvYXRPbkhlYXBNdXRhYmxlRGljdGlvbmFyeS5qYXZh) | `47.56% <0%> (-18.3%)` | `0% <0%> (ø)` | |
   | [...inot/client/JsonAsyncHttpPinotClientTransport.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L0pzb25Bc3luY0h0dHBQaW5vdENsaWVudFRyYW5zcG9ydC5qYXZh) | `58.69% <0%> (-15.22%)` | `0% <0%> (ø)` | |
   | [.../impl/dictionary/LongOffHeapMutableDictionary.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9yZWFsdGltZS9pbXBsL2RpY3Rpb25hcnkvTG9uZ09mZkhlYXBNdXRhYmxlRGljdGlvbmFyeS5qYXZh) | `51.61% <0%> (-13.98%)` | `0% <0%> (ø)` | |
   | [...impl/dictionary/DoubleOnHeapMutableDictionary.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9yZWFsdGltZS9pbXBsL2RpY3Rpb25hcnkvRG91YmxlT25IZWFwTXV0YWJsZURpY3Rpb25hcnkuamF2YQ==) | `39.02% <0%> (-4.88%)` | `0% <0%> (ø)` | |
   | [...ot/common/protocols/SegmentCompletionProtocol.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vcHJvdG9jb2xzL1NlZ21lbnRDb21wbGV0aW9uUHJvdG9jb2wuamF2YQ==) | `94.59% <0%> (+0.54%)` | `0% <0%> (ø)` | :arrow_down: |
   | [...ces/PinotSegmentUploadDownloadRestletResource.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtY29udHJvbGxlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29udHJvbGxlci9hcGkvcmVzb3VyY2VzL1Bpbm90U2VnbWVudFVwbG9hZERvd25sb2FkUmVzdGxldFJlc291cmNlLmphdmE=) | `61.34% <0%> (+0.61%)` | `0% <0%> (ø)` | :arrow_down: |
   | [...mpl/dictionary/DoubleOffHeapMutableDictionary.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9yZWFsdGltZS9pbXBsL2RpY3Rpb25hcnkvRG91YmxlT2ZmSGVhcE11dGFibGVEaWN0aW9uYXJ5LmphdmE=) | `43.01% <0%> (+1.07%)` | `0% <0%> (ø)` | :arrow_down: |
   | ... and [590 more](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/4964?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/4964?src=pr&el=footer). Last update [247af5d...54f9bf9](https://codecov.io/gh/apache/incubator-pinot/pull/4964?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

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


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] npawar commented on a change in pull request #4964: Sql query endpoint

Posted by GitBox <gi...@apache.org>.
npawar commented on a change in pull request #4964: Sql query endpoint
URL: https://github.com/apache/incubator-pinot/pull/4964#discussion_r364891528
 
 

 ##########
 File path: pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
 ##########
 @@ -67,9 +67,16 @@ public BrokerResponse executeQuery(String brokerAddress, String query)
   public Future<BrokerResponse> executePinotQueryAsync(String brokerAddress, final Request request) {
     try {
       ObjectNode json = JsonNodeFactory.instance.objectNode();
-      json.put(request.getQueryFormat(), request.getQuery());
-
-      final String url = "http://" + brokerAddress + "/query";
+      String queryFormat = request.getQueryFormat();
+      json.put(queryFormat, request.getQuery());
+
+      final String url;
+      if (queryFormat.equalsIgnoreCase("sql")) {
 
 Review comment:
   I had considered "/query/sql". But felt it was okay to go with just "sql", as we would eventually be getting rid of the "/query" endpoint.
   I don't have a strong preference either way. I can change it if majority think this one is better. I got a signoff on the issue #4962 for "/sql"
   

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


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] jackjlli commented on a change in pull request #4964: Sql query endpoint

Posted by GitBox <gi...@apache.org>.
jackjlli commented on a change in pull request #4964: Sql query endpoint
URL: https://github.com/apache/incubator-pinot/pull/4964#discussion_r363910978
 
 

 ##########
 File path: pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotClientRequest.java
 ##########
 @@ -103,4 +100,60 @@ public String processQueryPost(String query) {
       throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
     }
   }
+
+  @GET
+  @Produces(MediaType.APPLICATION_JSON)
+  @Path("sql")
+  @ApiOperation(value = "Querying pinot in sql")
+  @ApiResponses(value = {@ApiResponse(code = 200, message = "Query response"), @ApiResponse(code = 500, message = "Internal Server Error")})
+  public String processSqlQueryGet(@ApiParam(value = "Query", required = true) @QueryParam("sql") String query,
+      @ApiParam(value = "Trace enabled") @QueryParam(Request.TRACE) String traceEnabled,
+      @ApiParam(value = "Debug options") @QueryParam(Request.DEBUG_OPTIONS) String debugOptions) {
+    try {
+      ObjectNode requestJson = JsonUtils.newObjectNode();
+      requestJson.put(Request.SQL, query);
+      String queryOptions = constructSqlQueryOptions();
+      requestJson.put(Request.QUERY_OPTIONS, queryOptions);
+      if (traceEnabled != null) {
+        requestJson.put(Request.TRACE, traceEnabled);
+      }
+      if (debugOptions != null) {
+        requestJson.put(Request.DEBUG_OPTIONS, debugOptions);
+      }
+      BrokerResponse brokerResponse = requestHandler.handleRequest(requestJson, null, new RequestStatistics());
+      return brokerResponse.toJsonString();
+    } catch (Exception e) {
+      LOGGER.error("Caught exception while processing GET request", e);
+      brokerMetrics.addMeteredGlobalValue(BrokerMeter.UNCAUGHT_GET_EXCEPTIONS, 1L);
+      throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
+    }
+  }
+
+  @POST
+  @Produces(MediaType.APPLICATION_JSON)
+  @Path("sql")
+  @ApiOperation(value = "Querying pinot")
 
 Review comment:
   `"Querying pinot using sql"`?

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


With regards,
Apache Git Services

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


[GitHub] [incubator-pinot] codecov-io edited a comment on issue #4964: Sql query endpoint

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #4964: Sql query endpoint
URL: https://github.com/apache/incubator-pinot/pull/4964#issuecomment-571715802
 
 
   # [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/4964?src=pr&el=h1) Report
   > Merging [#4964](https://codecov.io/gh/apache/incubator-pinot/pull/4964?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-pinot/commit/a73e78b938485eeed08ae01cf67178d7b2acdaec?src=pr&el=desc) will **decrease** coverage by `0.41%`.
   > The diff coverage is `40.47%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-pinot/pull/4964/graphs/tree.svg?width=650&token=4ibza2ugkz&height=150&src=pr)](https://codecov.io/gh/apache/incubator-pinot/pull/4964?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #4964      +/-   ##
   ============================================
   - Coverage      57.5%   57.09%   -0.42%     
     Complexity       12       12              
   ============================================
     Files          1159     1175      +16     
     Lines         61837    62418     +581     
     Branches       9118     9184      +66     
   ============================================
   + Hits          35562    35638      +76     
   - Misses        23618    24119     +501     
   - Partials       2657     2661       +4
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-pinot/pull/4964?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...n/java/org/apache/pinot/client/BrokerResponse.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L0Jyb2tlclJlc3BvbnNlLmphdmE=) | `100% <100%> (ø)` | `0 <0> (ø)` | :arrow_down: |
   | [...inot/client/JsonAsyncHttpPinotClientTransport.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L0pzb25Bc3luY0h0dHBQaW5vdENsaWVudFRyYW5zcG9ydC5qYXZh) | `76% <100%> (+2.08%)` | `0 <0> (ø)` | :arrow_down: |
   | [...pinot/broker/api/resources/PinotClientRequest.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvYXBpL3Jlc291cmNlcy9QaW5vdENsaWVudFJlcXVlc3QuamF2YQ==) | `31.91% <20.68%> (-10.95%)` | `0 <0> (ø)` | |
   | [.../org/apache/pinot/client/ResultTableResultSet.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L1Jlc3VsdFRhYmxlUmVzdWx0U2V0LmphdmE=) | `28.57% <28.57%> (ø)` | `0 <0> (?)` | |
   | [...n/java/org/apache/pinot/client/ResultSetGroup.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L1Jlc3VsdFNldEdyb3VwLmphdmE=) | `65.21% <83.33%> (+3.31%)` | `0 <0> (ø)` | :arrow_down: |
   | [...a/manager/realtime/RealtimeSegmentDataManager.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9kYXRhL21hbmFnZXIvcmVhbHRpbWUvUmVhbHRpbWVTZWdtZW50RGF0YU1hbmFnZXIuamF2YQ==) | `50% <0%> (-25%)` | `0% <0%> (ø)` | |
   | [...impl/dictionary/DoubleOnHeapMutableDictionary.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9yZWFsdGltZS9pbXBsL2RpY3Rpb25hcnkvRG91YmxlT25IZWFwTXV0YWJsZURpY3Rpb25hcnkuamF2YQ==) | `39.02% <0%> (-7.32%)` | `0% <0%> (ø)` | |
   | [.../impl/dictionary/FloatOnHeapMutableDictionary.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9yZWFsdGltZS9pbXBsL2RpY3Rpb25hcnkvRmxvYXRPbkhlYXBNdXRhYmxlRGljdGlvbmFyeS5qYXZh) | `57.31% <0%> (-4.88%)` | `0% <0%> (ø)` | |
   | [...org/apache/pinot/client/DynamicBrokerSelector.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L0R5bmFtaWNCcm9rZXJTZWxlY3Rvci5qYXZh) | `69.69% <0%> (-3.04%)` | `0% <0%> (ø)` | |
   | [.../main/java/org/apache/pinot/client/Connection.java](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L0Nvbm5lY3Rpb24uamF2YQ==) | `47.61% <0%> (-2.39%)` | `0% <0%> (ø)` | |
   | ... and [38 more](https://codecov.io/gh/apache/incubator-pinot/pull/4964/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/4964?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/4964?src=pr&el=footer). Last update [a73e78b...0673350](https://codecov.io/gh/apache/incubator-pinot/pull/4964?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

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


With regards,
Apache Git Services

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