You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "J-HowHuang (via GitHub)" <gi...@apache.org> on 2025/02/26 17:41:01 UTC

[PR] Allow Query Plan while dropResult=true [pinot]

J-HowHuang opened a new pull request, #15136:
URL: https://github.com/apache/pinot/pull/15136

   For single stage query, explain queries like 
   ```sql
   SET dropResult = true;
   EXPLAIN PLAN FOR
   SELECT * FROM table;
   ```
   will drop the returned query plan. (in contrast, multi-stage queries will not)
   
   This PR fix the problem so as to make the behavior consistent in both single stage and multi-stage


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Allow Query Plan while dropResult=true [pinot]

Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on code in PR #15136:
URL: https://github.com/apache/pinot/pull/15136#discussion_r1972265073


##########
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseSingleStageBrokerRequestHandler.java:
##########
@@ -882,7 +882,7 @@ protected BrokerResponse doHandleRequest(long requestId, String query, SqlNodeAn
         .filter(exception -> exception.getErrorCode() == QueryException.QUERY_VALIDATION_ERROR_CODE)
         .findFirst()
         .ifPresent(exception -> _brokerMetrics.addMeteredGlobalValue(BrokerMeter.QUERY_VALIDATION_EXCEPTIONS, 1));
-    if (QueryOptionsUtils.shouldDropResults(pinotQuery.getQueryOptions())) {
+    if (QueryOptionsUtils.shouldDropResults(pinotQuery.getQueryOptions()) && !pinotQuery.isExplain()) {

Review Comment:
   (minor) Let's reverse these 2 checks because checking `explain` is much cheaper. Same for the other place



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Allow Query Plan while dropResult=true [pinot]

Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on code in PR #15136:
URL: https://github.com/apache/pinot/pull/15136#discussion_r1972266435


##########
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/HybridClusterIntegrationTest.java:
##########
@@ -342,6 +342,36 @@ public void testDropResults(boolean useMultiStageQueryEngine)
     Assert.assertTrue(postQueryWithOptions(query, "dropResults=truee").has(resultTag));
   }
 
+  @Test(dataProvider = "useBothQueryEngines")
+  public void testExplainDropResults(boolean useMultiStageQueryEngine)
+      throws Exception {
+    setUseMultiStageQueryEngine(useMultiStageQueryEngine);
+    final String resultTag = "resultTable";

Review Comment:
   (nit, convention) We don't usually use `final` for local var



##########
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/HybridClusterIntegrationTest.java:
##########
@@ -342,6 +342,36 @@ public void testDropResults(boolean useMultiStageQueryEngine)
     Assert.assertTrue(postQueryWithOptions(query, "dropResults=truee").has(resultTag));
   }
 
+  @Test(dataProvider = "useBothQueryEngines")
+  public void testExplainDropResults(boolean useMultiStageQueryEngine)
+      throws Exception {
+    setUseMultiStageQueryEngine(useMultiStageQueryEngine);
+    final String resultTag = "resultTable";
+    String query = String.format("EXPLAIN PLAN FOR SELECT * FROM %s limit 10", getTableName());
+
+    // dropResults=true - resultTable must be in the response (it is a query plan)
+    JsonNode jsonNode = postQueryWithOptions(query, "dropResults=true");
+    Assert.assertTrue(jsonNode.has(resultTag));
+    query = String.format("EXPLAIN PLAN WITHOUT IMPLEMENTATION FOR SELECT * FROM %s limit 10", getTableName());
+
+    // dropResults=true - resultTable must be in the response (it is a query plan)
+    jsonNode = postQueryWithOptions(query, "dropResults=true");
+    Assert.assertTrue(jsonNode.has(resultTag));
+
+    query = String.format("EXPLAIN IMPLEMENTATION PLAN FOR SELECT * FROM %s limit 10", getTableName());
+
+    // dropResults=true - resultTable must be in the response (it is a query plan)
+    jsonNode = postQueryWithOptions(query, "dropResults=true");
+    Assert.assertTrue(jsonNode.has(resultTag));
+
+    query = String.format("EXPLAIN PLAN FOR SELECT 1 + 1 FROM %s limit 10", getTableName());
+
+    // dropResults=true - resultTable must be in the response (it is a query plan)
+    jsonNode = postQueryWithOptions(query, "dropResults=true");
+    Assert.assertTrue(jsonNode.has(resultTag));
+

Review Comment:
   (nit) Remove empty line



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Allow Query Plan while dropResult=true [pinot]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #15136:
URL: https://github.com/apache/pinot/pull/15136#issuecomment-2686327333

   ## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/15136?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   All modified and coverable lines are covered by tests :white_check_mark:
   > Project coverage is 63.32%. Comparing base [(`59551e4`)](https://app.codecov.io/gh/apache/pinot/commit/59551e45224f1535c4863fd577622b37366ccc97?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`e189005`)](https://app.codecov.io/gh/apache/pinot/commit/e189005d55d0f13439ac72712ec49ca26533283e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   > Report is 1767 commits behind head on master.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #15136      +/-   ##
   ============================================
   + Coverage     61.75%   63.32%   +1.57%     
   - Complexity      207     1389    +1182     
   ============================================
     Files          2436     2751     +315     
     Lines        133233   154550   +21317     
     Branches      20636    23819    +3183     
   ============================================
   + Hits          82274    97870   +15596     
   - Misses        44911    49275    +4364     
   - Partials       6048     7405    +1357     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/pinot/pull/15136/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [custom-integration1](https://app.codecov.io/gh/apache/pinot/pull/15136/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration](https://app.codecov.io/gh/apache/pinot/pull/15136/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration1](https://app.codecov.io/gh/apache/pinot/pull/15136/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration2](https://app.codecov.io/gh/apache/pinot/pull/15136/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [java-11](https://app.codecov.io/gh/apache/pinot/pull/15136/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [java-21](https://app.codecov.io/gh/apache/pinot/pull/15136/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `63.32% <ø> (+1.70%)` | :arrow_up: |
   | [skip-bytebuffers-false](https://app.codecov.io/gh/apache/pinot/pull/15136/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `63.29% <ø> (+1.54%)` | :arrow_up: |
   | [skip-bytebuffers-true](https://app.codecov.io/gh/apache/pinot/pull/15136/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `55.91% <ø> (+28.18%)` | :arrow_up: |
   | [temurin](https://app.codecov.io/gh/apache/pinot/pull/15136/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `63.32% <ø> (+1.57%)` | :arrow_up: |
   | [unittests](https://app.codecov.io/gh/apache/pinot/pull/15136/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `63.32% <ø> (+1.57%)` | :arrow_up: |
   | [unittests1](https://app.codecov.io/gh/apache/pinot/pull/15136/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `55.93% <ø> (+9.03%)` | :arrow_up: |
   | [unittests2](https://app.codecov.io/gh/apache/pinot/pull/15136/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `33.95% <ø> (+6.21%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/pinot/pull/15136?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Allow Query Plan while dropResult=true [pinot]

Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang merged PR #15136:
URL: https://github.com/apache/pinot/pull/15136


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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