This is an automated email from the ASF dual-hosted git repository. siddteotia pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push: new 807f84392c fix empty data block not returning schema (#9222) 807f84392c is described below commit 807f84392cef640db5f7e87c210a05c025071f93 Author: Rong Rong <walterddr.walter...@gmail.com> AuthorDate: Wed Aug 17 08:56:03 2022 -0700 fix empty data block not returning schema (#9222) Co-authored-by: Rong Rong <ro...@startree.ai> --- .../pinot/integration/tests/MultiStageEngineIntegrationTest.java | 8 ++++---- .../main/java/org/apache/pinot/query/service/QueryDispatcher.java | 8 ++++---- .../test/java/org/apache/pinot/query/runtime/QueryRunnerTest.java | 3 +++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/MultiStageEngineIntegrationTest.java b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/MultiStageEngineIntegrationTest.java index 60b2c4211f..a639023b69 100644 --- a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/MultiStageEngineIntegrationTest.java +++ b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/MultiStageEngineIntegrationTest.java @@ -19,7 +19,6 @@ package org.apache.pinot.integration.tests; import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; import java.io.File; import java.io.IOException; import java.util.List; @@ -105,15 +104,16 @@ public class MultiStageEngineIntegrationTest extends BaseClusterIntegrationTest sendPostRequest(_brokerBaseApiUrl + "/query/sql", "{\"queryOptions\":\"useMultistageEngine=true\", \"sql\":\"" + sql + "\"}")); Assert.assertTrue(multiStageResponse.has("resultTable")); - ArrayNode jsonNode = (ArrayNode) multiStageResponse.get("resultTable").get("rows"); + JsonNode jsonNode = multiStageResponse.get("resultTable"); // TODO: assert actual result data payload. - Assert.assertEquals(jsonNode.size(), expectedNumOfRows); - Assert.assertEquals(jsonNode.get(0).size(), expectedNumOfColumns); + Assert.assertEquals(jsonNode.get("rows").size(), expectedNumOfRows); + Assert.assertEquals(jsonNode.get("dataSchema").get("columnNames").size(), expectedNumOfColumns); } @DataProvider public Object[][] multiStageQueryEngineSqlTestSet() { return new Object[][] { + new Object[]{"SELECT * FROM mytable_OFFLINE WHERE ArrDelay>10000", 0, 73}, new Object[]{"SELECT COUNT(*) FROM mytable_OFFLINE WHERE Carrier='AA'", 1, 1}, new Object[]{"SELECT * FROM mytable_OFFLINE WHERE ArrDelay>1000", 2, 73}, new Object[]{"SELECT CarrierDelay, ArrDelay FROM mytable_OFFLINE" diff --git a/pinot-query-runtime/src/main/java/org/apache/pinot/query/service/QueryDispatcher.java b/pinot-query-runtime/src/main/java/org/apache/pinot/query/service/QueryDispatcher.java index 0323bed72e..df98061a80 100644 --- a/pinot-query-runtime/src/main/java/org/apache/pinot/query/service/QueryDispatcher.java +++ b/pinot-query-runtime/src/main/java/org/apache/pinot/query/service/QueryDispatcher.java @@ -126,19 +126,19 @@ public class QueryDispatcher { long timeoutWatermark = System.nanoTime() + timeoutNano; while (System.nanoTime() < timeoutWatermark) { transferableBlock = mailboxReceiveOperator.nextBlock(); - if (TransferableBlockUtils.isEndOfStream(transferableBlock)) { + if (TransferableBlockUtils.isEndOfStream(transferableBlock) && transferableBlock.isErrorBlock()) { // TODO: we only received bubble up error from the execution stage tree. // TODO: query dispatch should also send cancel signal to the rest of the execution stage tree. - if (transferableBlock.isErrorBlock()) { throw new RuntimeException("Received error query execution result block: " + transferableBlock.getDataBlock().getExceptions()); - } - break; } if (transferableBlock.getDataBlock() != null) { BaseDataBlock dataTable = transferableBlock.getDataBlock(); resultDataBlocks.add(dataTable); } + if (transferableBlock.isEndOfStreamBlock()) { + break; + } } if (System.nanoTime() >= timeoutWatermark) { resultDataBlocks = Collections.singletonList( diff --git a/pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/QueryRunnerTest.java b/pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/QueryRunnerTest.java index 0fcddab91b..546e2befbc 100644 --- a/pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/QueryRunnerTest.java +++ b/pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/QueryRunnerTest.java @@ -69,6 +69,9 @@ public class QueryRunnerTest extends QueryRunnerTestBase { new Object[]{"SELECT * FROM b", 5}, new Object[]{"SELECT * FROM a", 15}, + // No match filter + new Object[]{"SELECT * FROM b WHERE col3 < 0", 0}, + // Specifically table A has 15 rows (10 on server1 and 5 on server2) and table B has 5 rows (all on server1), // thus the final JOIN result will be 15 x 1 = 15. // Next join with table C which has (5 on server1 and 10 on server2), since data is identical. each of the row --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org