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 2022/12/07 04:07:18 UTC

[GitHub] [pinot] walterddr opened a new pull request, #9929: Poc fix leaf stage return

walterddr opened a new pull request, #9929:
URL: https://github.com/apache/pinot/pull/9929

   this is a reland of #9892 after merge conflict resolution


-- 
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


[GitHub] [pinot] 61yao commented on a diff in pull request #9929: [multistage][reland] fix leaf stage return data schema

Posted by GitBox <gi...@apache.org>.
61yao commented on code in PR #9929:
URL: https://github.com/apache/pinot/pull/9929#discussion_r1042746932


##########
pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/operator/LeafStageTransferableBlockOperatorTest.java:
##########
@@ -24,98 +24,222 @@
 import java.util.List;
 import org.apache.pinot.common.exception.QueryException;
 import org.apache.pinot.common.utils.DataSchema;
+import org.apache.pinot.core.data.table.Record;
 import org.apache.pinot.core.operator.blocks.InstanceResponseBlock;
+import org.apache.pinot.core.operator.blocks.results.AggregationResultsBlock;
+import org.apache.pinot.core.operator.blocks.results.DistinctResultsBlock;
+import org.apache.pinot.core.operator.blocks.results.GroupByResultsBlock;
 import org.apache.pinot.core.operator.blocks.results.SelectionResultsBlock;
+import org.apache.pinot.core.query.aggregation.function.DistinctAggregationFunction;
+import org.apache.pinot.core.query.distinct.DistinctTable;
+import org.apache.pinot.core.query.request.context.QueryContext;
+import org.apache.pinot.core.query.request.context.utils.QueryContextConverterUtils;
 import org.apache.pinot.query.runtime.blocks.TransferableBlock;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
+import static org.mockito.Mockito.mock;
 
+
+// TODO: add tests for Agg / GroupBy / Distinct result blocks
 public class LeafStageTransferableBlockOperatorTest {
 
   @Test
   public void shouldReturnDataBlockThenMetadataBlock() {
     // Given:
+    QueryContext queryContext = QueryContextConverterUtils.getQueryContext("SELECT strCol, intCol FROM tbl");
     DataSchema schema = new DataSchema(new String[]{"strCol", "intCol"},
         new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.STRING, DataSchema.ColumnDataType.INT});
     List<InstanceResponseBlock> resultsBlockList = Collections.singletonList(new InstanceResponseBlock(
-        new SelectionResultsBlock(schema, Arrays.asList(new Object[]{"foo", 1}, new Object[]{"", 2})), null));
+        new SelectionResultsBlock(schema, Arrays.asList(new Object[]{"foo", 1}, new Object[]{"", 2})), queryContext));
     LeafStageTransferableBlockOperator operator = new LeafStageTransferableBlockOperator(resultsBlockList, schema);
 
     // When:
-    TransferableBlock transferableBlock = operator.nextBlock();
+    TransferableBlock resultBlock = operator.nextBlock();
 
     // Then:
-    Assert.assertEquals(transferableBlock.getContainer().get(0), new Object[]{"foo", 1});
-    Assert.assertEquals(transferableBlock.getContainer().get(1), new Object[]{"", 2});
+    Assert.assertEquals(resultBlock.getContainer().get(0), new Object[]{"foo", 1});
+    Assert.assertEquals(resultBlock.getContainer().get(1), new Object[]{"", 2});
+    Assert.assertTrue(operator.nextBlock().isEndOfStreamBlock(), "Expected EOS after reading two rows");
+  }
+
+  @Test
+  public void shouldHandleDesiredDataSchemaConversionCorrectly() {
+    // Given:
+    QueryContext queryContext = QueryContextConverterUtils.getQueryContext(
+        "SELECT boolCol, tsCol, boolCol AS newNamedBoolCol FROM tbl");
+    DataSchema resultSchema = new DataSchema(new String[]{"boolCol", "tsCol"},
+        new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.BOOLEAN, DataSchema.ColumnDataType.TIMESTAMP});
+    DataSchema desiredSchema = new DataSchema(new String[]{"boolCol", "tsCol", "newNamedBoolCol"},
+        new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.BOOLEAN, DataSchema.ColumnDataType.TIMESTAMP,
+            DataSchema.ColumnDataType.BOOLEAN});
+    List<InstanceResponseBlock> resultsBlockList = Collections.singletonList(new InstanceResponseBlock(
+        new SelectionResultsBlock(resultSchema, Arrays.asList(new Object[]{1, 1660000000000L},
+            new Object[]{0, 1600000000000L})), queryContext));
+    LeafStageTransferableBlockOperator operator = new LeafStageTransferableBlockOperator(resultsBlockList,
+        desiredSchema);
+
+    // When:
+    TransferableBlock resultBlock = operator.nextBlock();
+
+    // Then:
+    Assert.assertEquals(resultBlock.getContainer().get(0), new Object[]{true, new Timestamp(1660000000000L), true});
+    Assert.assertEquals(resultBlock.getContainer().get(1), new Object[]{false, new Timestamp(1600000000000L), false});
     Assert.assertTrue(operator.nextBlock().isEndOfStreamBlock(), "Expected EOS after reading two rows");
   }
 
   @Test
   public void shouldHandleCanonicalizationCorrectly() {
     // TODO: not all stored types are supported, add additional datatype when they are supported.
     // Given:
+    QueryContext queryContext = QueryContextConverterUtils.getQueryContext("SELECT boolCol, tsCol FROM tbl");
     DataSchema schema = new DataSchema(new String[]{"boolCol", "tsCol"},
         new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.BOOLEAN, DataSchema.ColumnDataType.TIMESTAMP});
     List<InstanceResponseBlock> resultsBlockList = Collections.singletonList(new InstanceResponseBlock(
         new SelectionResultsBlock(schema, Arrays.asList(new Object[]{1, 1660000000000L},
-            new Object[]{0, 1600000000000L})), null));
+            new Object[]{0, 1600000000000L})), queryContext));
     LeafStageTransferableBlockOperator operator = new LeafStageTransferableBlockOperator(resultsBlockList, schema);
 
     // When:
-    TransferableBlock transferableBlock = operator.nextBlock();
+    TransferableBlock resultBlock = operator.nextBlock();
 
     // Then:
-    Assert.assertEquals(transferableBlock.getContainer().get(0), new Object[]{true, new Timestamp(1660000000000L)});
-    Assert.assertEquals(transferableBlock.getContainer().get(1), new Object[]{false, new Timestamp(1600000000000L)});
+    Assert.assertEquals(resultBlock.getContainer().get(0), new Object[]{true, new Timestamp(1660000000000L)});
+    Assert.assertEquals(resultBlock.getContainer().get(1), new Object[]{false, new Timestamp(1600000000000L)});
     Assert.assertTrue(operator.nextBlock().isEndOfStreamBlock(), "Expected EOS after reading two rows");
   }
 
   @Test
   public void shouldReturnMultipleDataBlockThenMetadataBlock() {
     // Given:
+    QueryContext queryContext = QueryContextConverterUtils.getQueryContext("SELECT strCol, intCol FROM tbl");
     DataSchema schema = new DataSchema(new String[]{"strCol", "intCol"},
         new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.STRING, DataSchema.ColumnDataType.INT});
     List<InstanceResponseBlock> resultsBlockList = Arrays.asList(
         new InstanceResponseBlock(new SelectionResultsBlock(schema,
-            Arrays.asList(new Object[]{"foo", 1}, new Object[]{"", 2})), null),
+            Arrays.asList(new Object[]{"foo", 1}, new Object[]{"", 2})), queryContext),
         new InstanceResponseBlock(new SelectionResultsBlock(schema,
-            Arrays.asList(new Object[]{"bar", 3}, new Object[]{"foo", 4})), null),
-        new InstanceResponseBlock(new SelectionResultsBlock(schema, Collections.emptyList()), null));
+            Arrays.asList(new Object[]{"bar", 3}, new Object[]{"foo", 4})), queryContext),
+        new InstanceResponseBlock(new SelectionResultsBlock(schema, Collections.emptyList()), queryContext));
     LeafStageTransferableBlockOperator operator = new LeafStageTransferableBlockOperator(resultsBlockList, schema);
 
     // When:
-    TransferableBlock transferableBlock1 = operator.nextBlock();
-    TransferableBlock transferableBlock2 = operator.nextBlock();
-    TransferableBlock transferableBlock3 = operator.nextBlock();
+    TransferableBlock resultBlock1 = operator.nextBlock();
+    TransferableBlock resultBlock2 = operator.nextBlock();
+    TransferableBlock resultBlock3 = operator.nextBlock();
 
     // Then:
-    Assert.assertEquals(transferableBlock1.getContainer().get(0), new Object[]{"foo", 1});
-    Assert.assertEquals(transferableBlock1.getContainer().get(1), new Object[]{"", 2});
-    Assert.assertEquals(transferableBlock2.getContainer().get(0), new Object[]{"bar", 3});
-    Assert.assertEquals(transferableBlock2.getContainer().get(1), new Object[]{"foo", 4});
-    Assert.assertEquals(transferableBlock3.getContainer().size(), 0);
+    Assert.assertEquals(resultBlock1.getContainer().get(0), new Object[]{"foo", 1});
+    Assert.assertEquals(resultBlock1.getContainer().get(1), new Object[]{"", 2});
+    Assert.assertEquals(resultBlock2.getContainer().get(0), new Object[]{"bar", 3});
+    Assert.assertEquals(resultBlock2.getContainer().get(1), new Object[]{"foo", 4});
+    Assert.assertEquals(resultBlock3.getContainer().size(), 0);
     Assert.assertTrue(operator.nextBlock().isEndOfStreamBlock(), "Expected EOS after reading two rows");
   }
 
   @Test
   public void shouldGetErrorBlockWhenInstanceResponseContainsError() {
     // Given:
+    QueryContext queryContext = QueryContextConverterUtils.getQueryContext("SELECT strCol, intCol FROM tbl");
     DataSchema schema = new DataSchema(new String[]{"strCol", "intCol"},
         new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.STRING, DataSchema.ColumnDataType.INT});
     InstanceResponseBlock errorBlock = new InstanceResponseBlock();
     errorBlock.addException(QueryException.QUERY_EXECUTION_ERROR.getErrorCode(), "foobar");
     List<InstanceResponseBlock> resultsBlockList = Arrays.asList(
         new InstanceResponseBlock(new SelectionResultsBlock(schema,
-            Arrays.asList(new Object[]{"foo", 1}, new Object[]{"", 2})), null),
+            Arrays.asList(new Object[]{"foo", 1}, new Object[]{"", 2})), queryContext),
         errorBlock,
-        new InstanceResponseBlock(new SelectionResultsBlock(schema, Collections.emptyList()), null));
+        new InstanceResponseBlock(new SelectionResultsBlock(schema, Collections.emptyList()), queryContext));
+    LeafStageTransferableBlockOperator operator = new LeafStageTransferableBlockOperator(resultsBlockList, schema);
+
+    // When:
+    TransferableBlock resultBlock = operator.nextBlock();
+
+    // Then:
+    Assert.assertTrue(resultBlock.isErrorBlock());
+  }
+
+  @Test
+  public void shouldReorderWhenQueryContextAskForNotInOrderGroupByAsDistinct() {
+    // Given:
+    QueryContext queryContext = QueryContextConverterUtils.getQueryContext(
+        "SELECT intCol, strCol FROM tbl GROUP BY strCol, intCol");
+    // result schema doesn't match with DISTINCT columns using GROUP BY.
+    DataSchema schema = new DataSchema(new String[]{"intCol", "strCol"},
+        new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.INT, DataSchema.ColumnDataType.STRING});
+    List<InstanceResponseBlock> resultsBlockList = Collections.singletonList(
+        new InstanceResponseBlock(new DistinctResultsBlock(mock(DistinctAggregationFunction.class),
+            new DistinctTable(schema, Arrays.asList(
+                new Record(new Object[]{1, "foo"}), new Record(new Object[]{2, "bar"})))), queryContext));
+    LeafStageTransferableBlockOperator operator = new LeafStageTransferableBlockOperator(resultsBlockList, schema);
+
+    // When:
+    TransferableBlock resultBlock = operator.nextBlock();
+
+    // Then:
+    Assert.assertEquals(resultBlock.getContainer().get(0), new Object[]{1, "foo"});
+    Assert.assertEquals(resultBlock.getContainer().get(1), new Object[]{2, "bar"});
+  }
+
+  @Test
+  public void shouldParsedBlocksSuccessfullyWithDistinctQuery() {

Review Comment:
   Should we also test the code path for composeColumnIndexedTransferableBlock and composeAggregationTransferableBlock



-- 
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


[GitHub] [pinot] walterddr commented on a diff in pull request #9929: [multistage][reland] fix leaf stage return data schema

Posted by GitBox <gi...@apache.org>.
walterddr commented on code in PR #9929:
URL: https://github.com/apache/pinot/pull/9929#discussion_r1042765010


##########
pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/operator/LeafStageTransferableBlockOperatorTest.java:
##########
@@ -24,98 +24,222 @@
 import java.util.List;
 import org.apache.pinot.common.exception.QueryException;
 import org.apache.pinot.common.utils.DataSchema;
+import org.apache.pinot.core.data.table.Record;
 import org.apache.pinot.core.operator.blocks.InstanceResponseBlock;
+import org.apache.pinot.core.operator.blocks.results.AggregationResultsBlock;
+import org.apache.pinot.core.operator.blocks.results.DistinctResultsBlock;
+import org.apache.pinot.core.operator.blocks.results.GroupByResultsBlock;
 import org.apache.pinot.core.operator.blocks.results.SelectionResultsBlock;
+import org.apache.pinot.core.query.aggregation.function.DistinctAggregationFunction;
+import org.apache.pinot.core.query.distinct.DistinctTable;
+import org.apache.pinot.core.query.request.context.QueryContext;
+import org.apache.pinot.core.query.request.context.utils.QueryContextConverterUtils;
 import org.apache.pinot.query.runtime.blocks.TransferableBlock;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
+import static org.mockito.Mockito.mock;
 
+
+// TODO: add tests for Agg / GroupBy / Distinct result blocks
 public class LeafStageTransferableBlockOperatorTest {
 
   @Test
   public void shouldReturnDataBlockThenMetadataBlock() {
     // Given:
+    QueryContext queryContext = QueryContextConverterUtils.getQueryContext("SELECT strCol, intCol FROM tbl");
     DataSchema schema = new DataSchema(new String[]{"strCol", "intCol"},
         new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.STRING, DataSchema.ColumnDataType.INT});
     List<InstanceResponseBlock> resultsBlockList = Collections.singletonList(new InstanceResponseBlock(
-        new SelectionResultsBlock(schema, Arrays.asList(new Object[]{"foo", 1}, new Object[]{"", 2})), null));
+        new SelectionResultsBlock(schema, Arrays.asList(new Object[]{"foo", 1}, new Object[]{"", 2})), queryContext));
     LeafStageTransferableBlockOperator operator = new LeafStageTransferableBlockOperator(resultsBlockList, schema);
 
     // When:
-    TransferableBlock transferableBlock = operator.nextBlock();
+    TransferableBlock resultBlock = operator.nextBlock();
 
     // Then:
-    Assert.assertEquals(transferableBlock.getContainer().get(0), new Object[]{"foo", 1});
-    Assert.assertEquals(transferableBlock.getContainer().get(1), new Object[]{"", 2});
+    Assert.assertEquals(resultBlock.getContainer().get(0), new Object[]{"foo", 1});
+    Assert.assertEquals(resultBlock.getContainer().get(1), new Object[]{"", 2});
+    Assert.assertTrue(operator.nextBlock().isEndOfStreamBlock(), "Expected EOS after reading two rows");
+  }
+
+  @Test
+  public void shouldHandleDesiredDataSchemaConversionCorrectly() {
+    // Given:
+    QueryContext queryContext = QueryContextConverterUtils.getQueryContext(
+        "SELECT boolCol, tsCol, boolCol AS newNamedBoolCol FROM tbl");
+    DataSchema resultSchema = new DataSchema(new String[]{"boolCol", "tsCol"},
+        new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.BOOLEAN, DataSchema.ColumnDataType.TIMESTAMP});
+    DataSchema desiredSchema = new DataSchema(new String[]{"boolCol", "tsCol", "newNamedBoolCol"},
+        new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.BOOLEAN, DataSchema.ColumnDataType.TIMESTAMP,
+            DataSchema.ColumnDataType.BOOLEAN});
+    List<InstanceResponseBlock> resultsBlockList = Collections.singletonList(new InstanceResponseBlock(
+        new SelectionResultsBlock(resultSchema, Arrays.asList(new Object[]{1, 1660000000000L},
+            new Object[]{0, 1600000000000L})), queryContext));
+    LeafStageTransferableBlockOperator operator = new LeafStageTransferableBlockOperator(resultsBlockList,
+        desiredSchema);
+
+    // When:
+    TransferableBlock resultBlock = operator.nextBlock();
+
+    // Then:
+    Assert.assertEquals(resultBlock.getContainer().get(0), new Object[]{true, new Timestamp(1660000000000L), true});
+    Assert.assertEquals(resultBlock.getContainer().get(1), new Object[]{false, new Timestamp(1600000000000L), false});
     Assert.assertTrue(operator.nextBlock().isEndOfStreamBlock(), "Expected EOS after reading two rows");
   }
 
   @Test
   public void shouldHandleCanonicalizationCorrectly() {
     // TODO: not all stored types are supported, add additional datatype when they are supported.
     // Given:
+    QueryContext queryContext = QueryContextConverterUtils.getQueryContext("SELECT boolCol, tsCol FROM tbl");
     DataSchema schema = new DataSchema(new String[]{"boolCol", "tsCol"},
         new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.BOOLEAN, DataSchema.ColumnDataType.TIMESTAMP});
     List<InstanceResponseBlock> resultsBlockList = Collections.singletonList(new InstanceResponseBlock(
         new SelectionResultsBlock(schema, Arrays.asList(new Object[]{1, 1660000000000L},
-            new Object[]{0, 1600000000000L})), null));
+            new Object[]{0, 1600000000000L})), queryContext));
     LeafStageTransferableBlockOperator operator = new LeafStageTransferableBlockOperator(resultsBlockList, schema);
 
     // When:
-    TransferableBlock transferableBlock = operator.nextBlock();
+    TransferableBlock resultBlock = operator.nextBlock();
 
     // Then:
-    Assert.assertEquals(transferableBlock.getContainer().get(0), new Object[]{true, new Timestamp(1660000000000L)});
-    Assert.assertEquals(transferableBlock.getContainer().get(1), new Object[]{false, new Timestamp(1600000000000L)});
+    Assert.assertEquals(resultBlock.getContainer().get(0), new Object[]{true, new Timestamp(1660000000000L)});
+    Assert.assertEquals(resultBlock.getContainer().get(1), new Object[]{false, new Timestamp(1600000000000L)});
     Assert.assertTrue(operator.nextBlock().isEndOfStreamBlock(), "Expected EOS after reading two rows");
   }
 
   @Test
   public void shouldReturnMultipleDataBlockThenMetadataBlock() {
     // Given:
+    QueryContext queryContext = QueryContextConverterUtils.getQueryContext("SELECT strCol, intCol FROM tbl");
     DataSchema schema = new DataSchema(new String[]{"strCol", "intCol"},
         new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.STRING, DataSchema.ColumnDataType.INT});
     List<InstanceResponseBlock> resultsBlockList = Arrays.asList(
         new InstanceResponseBlock(new SelectionResultsBlock(schema,
-            Arrays.asList(new Object[]{"foo", 1}, new Object[]{"", 2})), null),
+            Arrays.asList(new Object[]{"foo", 1}, new Object[]{"", 2})), queryContext),
         new InstanceResponseBlock(new SelectionResultsBlock(schema,
-            Arrays.asList(new Object[]{"bar", 3}, new Object[]{"foo", 4})), null),
-        new InstanceResponseBlock(new SelectionResultsBlock(schema, Collections.emptyList()), null));
+            Arrays.asList(new Object[]{"bar", 3}, new Object[]{"foo", 4})), queryContext),
+        new InstanceResponseBlock(new SelectionResultsBlock(schema, Collections.emptyList()), queryContext));
     LeafStageTransferableBlockOperator operator = new LeafStageTransferableBlockOperator(resultsBlockList, schema);
 
     // When:
-    TransferableBlock transferableBlock1 = operator.nextBlock();
-    TransferableBlock transferableBlock2 = operator.nextBlock();
-    TransferableBlock transferableBlock3 = operator.nextBlock();
+    TransferableBlock resultBlock1 = operator.nextBlock();
+    TransferableBlock resultBlock2 = operator.nextBlock();
+    TransferableBlock resultBlock3 = operator.nextBlock();
 
     // Then:
-    Assert.assertEquals(transferableBlock1.getContainer().get(0), new Object[]{"foo", 1});
-    Assert.assertEquals(transferableBlock1.getContainer().get(1), new Object[]{"", 2});
-    Assert.assertEquals(transferableBlock2.getContainer().get(0), new Object[]{"bar", 3});
-    Assert.assertEquals(transferableBlock2.getContainer().get(1), new Object[]{"foo", 4});
-    Assert.assertEquals(transferableBlock3.getContainer().size(), 0);
+    Assert.assertEquals(resultBlock1.getContainer().get(0), new Object[]{"foo", 1});
+    Assert.assertEquals(resultBlock1.getContainer().get(1), new Object[]{"", 2});
+    Assert.assertEquals(resultBlock2.getContainer().get(0), new Object[]{"bar", 3});
+    Assert.assertEquals(resultBlock2.getContainer().get(1), new Object[]{"foo", 4});
+    Assert.assertEquals(resultBlock3.getContainer().size(), 0);
     Assert.assertTrue(operator.nextBlock().isEndOfStreamBlock(), "Expected EOS after reading two rows");
   }
 
   @Test
   public void shouldGetErrorBlockWhenInstanceResponseContainsError() {
     // Given:
+    QueryContext queryContext = QueryContextConverterUtils.getQueryContext("SELECT strCol, intCol FROM tbl");
     DataSchema schema = new DataSchema(new String[]{"strCol", "intCol"},
         new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.STRING, DataSchema.ColumnDataType.INT});
     InstanceResponseBlock errorBlock = new InstanceResponseBlock();
     errorBlock.addException(QueryException.QUERY_EXECUTION_ERROR.getErrorCode(), "foobar");
     List<InstanceResponseBlock> resultsBlockList = Arrays.asList(
         new InstanceResponseBlock(new SelectionResultsBlock(schema,
-            Arrays.asList(new Object[]{"foo", 1}, new Object[]{"", 2})), null),
+            Arrays.asList(new Object[]{"foo", 1}, new Object[]{"", 2})), queryContext),
         errorBlock,
-        new InstanceResponseBlock(new SelectionResultsBlock(schema, Collections.emptyList()), null));
+        new InstanceResponseBlock(new SelectionResultsBlock(schema, Collections.emptyList()), queryContext));
+    LeafStageTransferableBlockOperator operator = new LeafStageTransferableBlockOperator(resultsBlockList, schema);
+
+    // When:
+    TransferableBlock resultBlock = operator.nextBlock();
+
+    // Then:
+    Assert.assertTrue(resultBlock.isErrorBlock());
+  }
+
+  @Test
+  public void shouldReorderWhenQueryContextAskForNotInOrderGroupByAsDistinct() {
+    // Given:
+    QueryContext queryContext = QueryContextConverterUtils.getQueryContext(
+        "SELECT intCol, strCol FROM tbl GROUP BY strCol, intCol");
+    // result schema doesn't match with DISTINCT columns using GROUP BY.
+    DataSchema schema = new DataSchema(new String[]{"intCol", "strCol"},
+        new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.INT, DataSchema.ColumnDataType.STRING});
+    List<InstanceResponseBlock> resultsBlockList = Collections.singletonList(
+        new InstanceResponseBlock(new DistinctResultsBlock(mock(DistinctAggregationFunction.class),
+            new DistinctTable(schema, Arrays.asList(
+                new Record(new Object[]{1, "foo"}), new Record(new Object[]{2, "bar"})))), queryContext));
+    LeafStageTransferableBlockOperator operator = new LeafStageTransferableBlockOperator(resultsBlockList, schema);
+
+    // When:
+    TransferableBlock resultBlock = operator.nextBlock();
+
+    // Then:
+    Assert.assertEquals(resultBlock.getContainer().get(0), new Object[]{1, "foo"});
+    Assert.assertEquals(resultBlock.getContainer().get(1), new Object[]{2, "bar"});
+  }
+
+  @Test
+  public void shouldParsedBlocksSuccessfullyWithDistinctQuery() {

Review Comment:
   also tested in shouldHandleDesiredDataSchemaConversionCorrectly



-- 
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


[GitHub] [pinot] walterddr merged pull request #9929: [multistage][reland] fix leaf stage return data schema

Posted by GitBox <gi...@apache.org>.
walterddr merged PR #9929:
URL: https://github.com/apache/pinot/pull/9929


-- 
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


[GitHub] [pinot] walterddr commented on a diff in pull request #9929: [multistage][reland] fix leaf stage return data schema

Posted by GitBox <gi...@apache.org>.
walterddr commented on code in PR #9929:
URL: https://github.com/apache/pinot/pull/9929#discussion_r1042756492


##########
pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/operator/LeafStageTransferableBlockOperatorTest.java:
##########
@@ -24,98 +24,222 @@
 import java.util.List;
 import org.apache.pinot.common.exception.QueryException;
 import org.apache.pinot.common.utils.DataSchema;
+import org.apache.pinot.core.data.table.Record;
 import org.apache.pinot.core.operator.blocks.InstanceResponseBlock;
+import org.apache.pinot.core.operator.blocks.results.AggregationResultsBlock;
+import org.apache.pinot.core.operator.blocks.results.DistinctResultsBlock;
+import org.apache.pinot.core.operator.blocks.results.GroupByResultsBlock;
 import org.apache.pinot.core.operator.blocks.results.SelectionResultsBlock;
+import org.apache.pinot.core.query.aggregation.function.DistinctAggregationFunction;
+import org.apache.pinot.core.query.distinct.DistinctTable;
+import org.apache.pinot.core.query.request.context.QueryContext;
+import org.apache.pinot.core.query.request.context.utils.QueryContextConverterUtils;
 import org.apache.pinot.query.runtime.blocks.TransferableBlock;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
+import static org.mockito.Mockito.mock;
 
+
+// TODO: add tests for Agg / GroupBy / Distinct result blocks
 public class LeafStageTransferableBlockOperatorTest {
 
   @Test
   public void shouldReturnDataBlockThenMetadataBlock() {
     // Given:
+    QueryContext queryContext = QueryContextConverterUtils.getQueryContext("SELECT strCol, intCol FROM tbl");
     DataSchema schema = new DataSchema(new String[]{"strCol", "intCol"},
         new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.STRING, DataSchema.ColumnDataType.INT});
     List<InstanceResponseBlock> resultsBlockList = Collections.singletonList(new InstanceResponseBlock(
-        new SelectionResultsBlock(schema, Arrays.asList(new Object[]{"foo", 1}, new Object[]{"", 2})), null));
+        new SelectionResultsBlock(schema, Arrays.asList(new Object[]{"foo", 1}, new Object[]{"", 2})), queryContext));
     LeafStageTransferableBlockOperator operator = new LeafStageTransferableBlockOperator(resultsBlockList, schema);
 
     // When:
-    TransferableBlock transferableBlock = operator.nextBlock();
+    TransferableBlock resultBlock = operator.nextBlock();
 
     // Then:
-    Assert.assertEquals(transferableBlock.getContainer().get(0), new Object[]{"foo", 1});
-    Assert.assertEquals(transferableBlock.getContainer().get(1), new Object[]{"", 2});
+    Assert.assertEquals(resultBlock.getContainer().get(0), new Object[]{"foo", 1});
+    Assert.assertEquals(resultBlock.getContainer().get(1), new Object[]{"", 2});
+    Assert.assertTrue(operator.nextBlock().isEndOfStreamBlock(), "Expected EOS after reading two rows");
+  }
+
+  @Test
+  public void shouldHandleDesiredDataSchemaConversionCorrectly() {
+    // Given:
+    QueryContext queryContext = QueryContextConverterUtils.getQueryContext(
+        "SELECT boolCol, tsCol, boolCol AS newNamedBoolCol FROM tbl");
+    DataSchema resultSchema = new DataSchema(new String[]{"boolCol", "tsCol"},
+        new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.BOOLEAN, DataSchema.ColumnDataType.TIMESTAMP});
+    DataSchema desiredSchema = new DataSchema(new String[]{"boolCol", "tsCol", "newNamedBoolCol"},
+        new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.BOOLEAN, DataSchema.ColumnDataType.TIMESTAMP,
+            DataSchema.ColumnDataType.BOOLEAN});
+    List<InstanceResponseBlock> resultsBlockList = Collections.singletonList(new InstanceResponseBlock(
+        new SelectionResultsBlock(resultSchema, Arrays.asList(new Object[]{1, 1660000000000L},
+            new Object[]{0, 1600000000000L})), queryContext));
+    LeafStageTransferableBlockOperator operator = new LeafStageTransferableBlockOperator(resultsBlockList,
+        desiredSchema);
+
+    // When:
+    TransferableBlock resultBlock = operator.nextBlock();
+
+    // Then:
+    Assert.assertEquals(resultBlock.getContainer().get(0), new Object[]{true, new Timestamp(1660000000000L), true});
+    Assert.assertEquals(resultBlock.getContainer().get(1), new Object[]{false, new Timestamp(1600000000000L), false});
     Assert.assertTrue(operator.nextBlock().isEndOfStreamBlock(), "Expected EOS after reading two rows");
   }
 
   @Test
   public void shouldHandleCanonicalizationCorrectly() {
     // TODO: not all stored types are supported, add additional datatype when they are supported.
     // Given:
+    QueryContext queryContext = QueryContextConverterUtils.getQueryContext("SELECT boolCol, tsCol FROM tbl");
     DataSchema schema = new DataSchema(new String[]{"boolCol", "tsCol"},
         new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.BOOLEAN, DataSchema.ColumnDataType.TIMESTAMP});
     List<InstanceResponseBlock> resultsBlockList = Collections.singletonList(new InstanceResponseBlock(
         new SelectionResultsBlock(schema, Arrays.asList(new Object[]{1, 1660000000000L},
-            new Object[]{0, 1600000000000L})), null));
+            new Object[]{0, 1600000000000L})), queryContext));
     LeafStageTransferableBlockOperator operator = new LeafStageTransferableBlockOperator(resultsBlockList, schema);
 
     // When:
-    TransferableBlock transferableBlock = operator.nextBlock();
+    TransferableBlock resultBlock = operator.nextBlock();
 
     // Then:
-    Assert.assertEquals(transferableBlock.getContainer().get(0), new Object[]{true, new Timestamp(1660000000000L)});
-    Assert.assertEquals(transferableBlock.getContainer().get(1), new Object[]{false, new Timestamp(1600000000000L)});
+    Assert.assertEquals(resultBlock.getContainer().get(0), new Object[]{true, new Timestamp(1660000000000L)});
+    Assert.assertEquals(resultBlock.getContainer().get(1), new Object[]{false, new Timestamp(1600000000000L)});
     Assert.assertTrue(operator.nextBlock().isEndOfStreamBlock(), "Expected EOS after reading two rows");
   }
 
   @Test
   public void shouldReturnMultipleDataBlockThenMetadataBlock() {
     // Given:
+    QueryContext queryContext = QueryContextConverterUtils.getQueryContext("SELECT strCol, intCol FROM tbl");
     DataSchema schema = new DataSchema(new String[]{"strCol", "intCol"},
         new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.STRING, DataSchema.ColumnDataType.INT});
     List<InstanceResponseBlock> resultsBlockList = Arrays.asList(
         new InstanceResponseBlock(new SelectionResultsBlock(schema,
-            Arrays.asList(new Object[]{"foo", 1}, new Object[]{"", 2})), null),
+            Arrays.asList(new Object[]{"foo", 1}, new Object[]{"", 2})), queryContext),
         new InstanceResponseBlock(new SelectionResultsBlock(schema,
-            Arrays.asList(new Object[]{"bar", 3}, new Object[]{"foo", 4})), null),
-        new InstanceResponseBlock(new SelectionResultsBlock(schema, Collections.emptyList()), null));
+            Arrays.asList(new Object[]{"bar", 3}, new Object[]{"foo", 4})), queryContext),
+        new InstanceResponseBlock(new SelectionResultsBlock(schema, Collections.emptyList()), queryContext));
     LeafStageTransferableBlockOperator operator = new LeafStageTransferableBlockOperator(resultsBlockList, schema);
 
     // When:
-    TransferableBlock transferableBlock1 = operator.nextBlock();
-    TransferableBlock transferableBlock2 = operator.nextBlock();
-    TransferableBlock transferableBlock3 = operator.nextBlock();
+    TransferableBlock resultBlock1 = operator.nextBlock();
+    TransferableBlock resultBlock2 = operator.nextBlock();
+    TransferableBlock resultBlock3 = operator.nextBlock();
 
     // Then:
-    Assert.assertEquals(transferableBlock1.getContainer().get(0), new Object[]{"foo", 1});
-    Assert.assertEquals(transferableBlock1.getContainer().get(1), new Object[]{"", 2});
-    Assert.assertEquals(transferableBlock2.getContainer().get(0), new Object[]{"bar", 3});
-    Assert.assertEquals(transferableBlock2.getContainer().get(1), new Object[]{"foo", 4});
-    Assert.assertEquals(transferableBlock3.getContainer().size(), 0);
+    Assert.assertEquals(resultBlock1.getContainer().get(0), new Object[]{"foo", 1});
+    Assert.assertEquals(resultBlock1.getContainer().get(1), new Object[]{"", 2});
+    Assert.assertEquals(resultBlock2.getContainer().get(0), new Object[]{"bar", 3});
+    Assert.assertEquals(resultBlock2.getContainer().get(1), new Object[]{"foo", 4});
+    Assert.assertEquals(resultBlock3.getContainer().size(), 0);
     Assert.assertTrue(operator.nextBlock().isEndOfStreamBlock(), "Expected EOS after reading two rows");
   }
 
   @Test
   public void shouldGetErrorBlockWhenInstanceResponseContainsError() {
     // Given:
+    QueryContext queryContext = QueryContextConverterUtils.getQueryContext("SELECT strCol, intCol FROM tbl");
     DataSchema schema = new DataSchema(new String[]{"strCol", "intCol"},
         new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.STRING, DataSchema.ColumnDataType.INT});
     InstanceResponseBlock errorBlock = new InstanceResponseBlock();
     errorBlock.addException(QueryException.QUERY_EXECUTION_ERROR.getErrorCode(), "foobar");
     List<InstanceResponseBlock> resultsBlockList = Arrays.asList(
         new InstanceResponseBlock(new SelectionResultsBlock(schema,
-            Arrays.asList(new Object[]{"foo", 1}, new Object[]{"", 2})), null),
+            Arrays.asList(new Object[]{"foo", 1}, new Object[]{"", 2})), queryContext),
         errorBlock,
-        new InstanceResponseBlock(new SelectionResultsBlock(schema, Collections.emptyList()), null));
+        new InstanceResponseBlock(new SelectionResultsBlock(schema, Collections.emptyList()), queryContext));
+    LeafStageTransferableBlockOperator operator = new LeafStageTransferableBlockOperator(resultsBlockList, schema);
+
+    // When:
+    TransferableBlock resultBlock = operator.nextBlock();
+
+    // Then:
+    Assert.assertTrue(resultBlock.isErrorBlock());
+  }
+
+  @Test
+  public void shouldReorderWhenQueryContextAskForNotInOrderGroupByAsDistinct() {
+    // Given:
+    QueryContext queryContext = QueryContextConverterUtils.getQueryContext(
+        "SELECT intCol, strCol FROM tbl GROUP BY strCol, intCol");
+    // result schema doesn't match with DISTINCT columns using GROUP BY.
+    DataSchema schema = new DataSchema(new String[]{"intCol", "strCol"},
+        new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.INT, DataSchema.ColumnDataType.STRING});
+    List<InstanceResponseBlock> resultsBlockList = Collections.singletonList(
+        new InstanceResponseBlock(new DistinctResultsBlock(mock(DistinctAggregationFunction.class),
+            new DistinctTable(schema, Arrays.asList(
+                new Record(new Object[]{1, "foo"}), new Record(new Object[]{2, "bar"})))), queryContext));
+    LeafStageTransferableBlockOperator operator = new LeafStageTransferableBlockOperator(resultsBlockList, schema);
+
+    // When:
+    TransferableBlock resultBlock = operator.nextBlock();
+
+    // Then:
+    Assert.assertEquals(resultBlock.getContainer().get(0), new Object[]{1, "foo"});
+    Assert.assertEquals(resultBlock.getContainer().get(1), new Object[]{2, "bar"});
+  }
+
+  @Test
+  public void shouldParsedBlocksSuccessfullyWithDistinctQuery() {

Review Comment:
   it is being tested via sql json 



-- 
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


[GitHub] [pinot] codecov-commenter commented on pull request #9929: [multistage][reland] fix leaf stage return data schema

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #9929:
URL: https://github.com/apache/pinot/pull/9929#issuecomment-1340368360

   # [Codecov](https://codecov.io/gh/apache/pinot/pull/9929?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#9929](https://codecov.io/gh/apache/pinot/pull/9929?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (dfd4459) into [master](https://codecov.io/gh/apache/pinot/commit/969a6d59fa1f31d979e3a5977368e1513ae1180e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (969a6d5) will **increase** coverage by `36.31%`.
   > The diff coverage is `82.55%`.
   
   ```diff
   @@              Coverage Diff              @@
   ##             master    #9929       +/-   ##
   =============================================
   + Coverage     28.02%   64.34%   +36.31%     
   - Complexity       53     5037     +4984     
   =============================================
     Files          1970     1928       -42     
     Lines        106096   104062     -2034     
     Branches      16093    15852      -241     
   =============================================
   + Hits          29738    66955    +37217     
   + Misses        73424    32278    -41146     
   - Partials       2934     4829     +1895     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | integration1 | `?` | |
   | integration2 | `?` | |
   | unittests1 | `68.01% <82.55%> (?)` | |
   | unittests2 | `15.88% <82.55%> (?)` | |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/pinot/pull/9929?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...va/org/apache/pinot/query/runtime/QueryRunner.java](https://codecov.io/gh/apache/pinot/pull/9929/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtcXVlcnktcnVudGltZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvcXVlcnkvcnVudGltZS9RdWVyeVJ1bm5lci5qYXZh) | `84.09% <33.33%> (+84.09%)` | :arrow_up: |
   | [...e/operator/LeafStageTransferableBlockOperator.java](https://codecov.io/gh/apache/pinot/pull/9929/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtcXVlcnktcnVudGltZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvcXVlcnkvcnVudGltZS9vcGVyYXRvci9MZWFmU3RhZ2VUcmFuc2ZlcmFibGVCbG9ja09wZXJhdG9yLmphdmE=) | `83.33% <84.33%> (+83.33%)` | :arrow_up: |
   | [...va/org/apache/pinot/common/config/NettyConfig.java](https://codecov.io/gh/apache/pinot/pull/9929/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vY29uZmlnL05ldHR5Q29uZmlnLmphdmE=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...a/org/apache/pinot/common/metrics/MinionMeter.java](https://codecov.io/gh/apache/pinot/pull/9929/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWV0cmljcy9NaW5pb25NZXRlci5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...g/apache/pinot/common/metrics/ControllerMeter.java](https://codecov.io/gh/apache/pinot/pull/9929/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWV0cmljcy9Db250cm9sbGVyTWV0ZXIuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [.../apache/pinot/common/metrics/BrokerQueryPhase.java](https://codecov.io/gh/apache/pinot/pull/9929/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWV0cmljcy9Ccm9rZXJRdWVyeVBoYXNlLmphdmE=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [.../apache/pinot/common/metrics/MinionQueryPhase.java](https://codecov.io/gh/apache/pinot/pull/9929/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWV0cmljcy9NaW5pb25RdWVyeVBoYXNlLmphdmE=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...ache/pinot/server/access/AccessControlFactory.java](https://codecov.io/gh/apache/pinot/pull/9929/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3Qvc2VydmVyL2FjY2Vzcy9BY2Nlc3NDb250cm9sRmFjdG9yeS5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...he/pinot/common/messages/SegmentReloadMessage.java](https://codecov.io/gh/apache/pinot/pull/9929/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWVzc2FnZXMvU2VnbWVudFJlbG9hZE1lc3NhZ2UuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...he/pinot/common/messages/TableDeletionMessage.java](https://codecov.io/gh/apache/pinot/pull/9929/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWVzc2FnZXMvVGFibGVEZWxldGlvbk1lc3NhZ2UuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | ... and [1615 more](https://codecov.io/gh/apache/pinot/pull/9929/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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


[GitHub] [pinot] 61yao commented on a diff in pull request #9929: [multistage][reland] fix leaf stage return data schema

Posted by GitBox <gi...@apache.org>.
61yao commented on code in PR #9929:
URL: https://github.com/apache/pinot/pull/9929#discussion_r1041763694


##########
pinot-query-runtime/src/test/resources/queries/Distincts.json:
##########
@@ -0,0 +1,47 @@
+{
+  "general_distinct": {
+    "tables": {
+      "tbl": {
+        "schema": [
+          { "name": "intCol", "type": "INT" },
+          { "name": "doubleCol", "type": "DOUBLE" },
+          { "name": "strCol", "type": "STRING" },
+          { "name": "boolCol", "type": "BOOLEAN" }
+        ],
+        "inputs": [
+          [ 2, 300, "a", true ],
+          [ 2, 400, "a", true ],
+          [ 3, 100, "b", false ],
+          [ 100, 1, "b", false ],
+          [ 101, 1.01, "c", false ],
+          [ 150, 1.5, "c", false ],
+          [ 175, 1.75, "c", true ]
+        ]
+      }
+    },
+    "queries": [
+      { "sql":  "SELECT DISTINCT intCol FROM {tbl}" },

Review Comment:
   Can we add 
   select distinct intCol, intCol FROM {tbl1} 
   select distinct col, 1, 2, 3 FROM {tbl1}
   



-- 
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