From 5e28104f27940d0c79a1d948b2cd8992d9ef57d5 Mon Sep 17 00:00:00 2001 From: Rong Rong Date: Wed, 21 Sep 2022 11:07:45 -0700 Subject: [PATCH 1/7] [stash] adding support for range --- .../rules/PinotFilterExpandSearchRule.java | 39 +++++++++++++++++++ .../calcite/rel/rules/PinotQueryRuleSets.java | 1 + .../pinot/query/runtime/QueryRunnerTest.java | 4 ++ 3 files changed, 44 insertions(+) create mode 100644 pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotFilterExpandSearchRule.java diff --git a/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotFilterExpandSearchRule.java b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotFilterExpandSearchRule.java new file mode 100644 index 000000000000..9780f0e51ca0 --- /dev/null +++ b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotFilterExpandSearchRule.java @@ -0,0 +1,39 @@ +package org.apache.calcite.rel.rules; + +import org.apache.calcite.plan.RelOptRule; +import org.apache.calcite.plan.RelOptRuleCall; +import org.apache.calcite.rel.core.Filter; +import org.apache.calcite.rel.logical.LogicalFilter; +import org.apache.calcite.rex.RexNode; +import org.apache.calcite.rex.RexUtil; +import org.apache.calcite.sql.SqlKind; +import org.apache.calcite.tools.RelBuilderFactory; + + +public class PinotFilterExpandSearchRule extends RelOptRule { + public static final PinotFilterExpandSearchRule INSTANCE = + new PinotFilterExpandSearchRule(PinotRuleUtils.PINOT_REL_FACTORY); + + public PinotFilterExpandSearchRule(RelBuilderFactory factory) { + super(operand(LogicalFilter.class, any()), factory, null); + } + + @Override + public boolean matches(RelOptRuleCall call) { + if (call.rels.length < 1) { + return false; + } + if (call.rel(0) instanceof Filter) { + Filter filter = call.rel(0); + return filter.getCondition().getKind() == SqlKind.SEARCH; + } + return false; + } + + @Override + public void onMatch(RelOptRuleCall call) { + Filter filter = call.rel(0); + RexNode newCondition = RexUtil.expandSearch(filter.getCluster().getRexBuilder(), null, filter.getCondition()); + call.transformTo(LogicalFilter.create(filter.getInput(), newCondition)); + } +} diff --git a/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotQueryRuleSets.java b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotQueryRuleSets.java index 84865be0847f..e5361bc8ece4 100644 --- a/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotQueryRuleSets.java +++ b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotQueryRuleSets.java @@ -90,6 +90,7 @@ private PinotQueryRuleSets() { PruneEmptyRules.UNION_INSTANCE, // Pinot specific rules + PinotFilterExpandSearchRule.INSTANCE, PinotJoinExchangeNodeInsertRule.INSTANCE, PinotAggregateExchangeNodeInsertRule.INSTANCE, PinotSortExchangeNodeInsertRule.INSTANCE 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 5bfd3511bd46..17a1d3a38142 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 @@ -200,6 +200,10 @@ private Object[][] provideTestSql() { new Object[]{"SELECT a.col1, b.col2 FROM a JOIN b ON a.col1 = b.col1 " + " WHERE a.col1 IN ('foo') AND b.col2 NOT IN ('')"}, + // Range conditions with continuous and non-continuous range. + new Object[]{"SELECT a.col1, b.col2 FROM a JOIN b ON a.col1 = b.col1 " + + " WHERE a.col3 IN (1, 2, 3) OR (a.col3 > 10 AND a.col3 < 50)"}, + // Projection pushdown new Object[]{"SELECT a.col1, a.col3 + a.col3 FROM a WHERE a.col3 >= 0 AND a.col2 = 'alice'"}, From 111d03cb3939f82e23669a6c160e8bdea407e257 Mon Sep 17 00:00:00 2001 From: Rong Rong Date: Wed, 21 Sep 2022 11:25:03 -0700 Subject: [PATCH 2/7] adding rules to only convert non-point searches --- .../rel/rules/PinotFilterExpandSearchRule.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotFilterExpandSearchRule.java b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotFilterExpandSearchRule.java index 9780f0e51ca0..a87a7caa234f 100644 --- a/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotFilterExpandSearchRule.java +++ b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotFilterExpandSearchRule.java @@ -1,13 +1,17 @@ package org.apache.calcite.rel.rules; +import java.util.List; import org.apache.calcite.plan.RelOptRule; import org.apache.calcite.plan.RelOptRuleCall; import org.apache.calcite.rel.core.Filter; import org.apache.calcite.rel.logical.LogicalFilter; +import org.apache.calcite.rex.RexCall; +import org.apache.calcite.rex.RexLiteral; import org.apache.calcite.rex.RexNode; import org.apache.calcite.rex.RexUtil; import org.apache.calcite.sql.SqlKind; import org.apache.calcite.tools.RelBuilderFactory; +import org.apache.calcite.util.Sarg; public class PinotFilterExpandSearchRule extends RelOptRule { @@ -19,13 +23,20 @@ public PinotFilterExpandSearchRule(RelBuilderFactory factory) { } @Override + @SuppressWarnings("rawtypes") public boolean matches(RelOptRuleCall call) { if (call.rels.length < 1) { return false; } if (call.rel(0) instanceof Filter) { Filter filter = call.rel(0); - return filter.getCondition().getKind() == SqlKind.SEARCH; + if (filter.getCondition().getKind() == SqlKind.SEARCH) { + RexCall rexCall = (RexCall) filter.getCondition(); + List operands = rexCall.getOperands(); + RexLiteral rexLiteral = (RexLiteral) operands.get(1); + Sarg sarg = rexLiteral.getValueAs(Sarg.class); + return sarg != null && !sarg.isPoints() && !sarg.isComplementedPoints(); + } } return false; } From 56a94437dd042f98af68abe1185beaebd8a2d813 Mon Sep 17 00:00:00 2001 From: Rong Rong Date: Wed, 21 Sep 2022 11:36:22 -0700 Subject: [PATCH 3/7] fix license --- .../rel/rules/PinotFilterExpandSearchRule.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotFilterExpandSearchRule.java b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotFilterExpandSearchRule.java index a87a7caa234f..856e230a51e2 100644 --- a/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotFilterExpandSearchRule.java +++ b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotFilterExpandSearchRule.java @@ -1,3 +1,21 @@ +/** + * 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.calcite.rel.rules; import java.util.List; From f37976aa295a883dbdf07b8999b8c81933b16508 Mon Sep 17 00:00:00 2001 From: Rong Rong Date: Wed, 21 Sep 2022 13:05:09 -0700 Subject: [PATCH 4/7] make rule expand all filter with search --- .../rules/PinotFilterExpandSearchRule.java | 29 ++++++++++++------- .../pinot/query/runtime/QueryRunnerTest.java | 3 ++ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotFilterExpandSearchRule.java b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotFilterExpandSearchRule.java index 856e230a51e2..37c2aabc74af 100644 --- a/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotFilterExpandSearchRule.java +++ b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotFilterExpandSearchRule.java @@ -18,18 +18,14 @@ */ package org.apache.calcite.rel.rules; -import java.util.List; import org.apache.calcite.plan.RelOptRule; import org.apache.calcite.plan.RelOptRuleCall; import org.apache.calcite.rel.core.Filter; import org.apache.calcite.rel.logical.LogicalFilter; import org.apache.calcite.rex.RexCall; -import org.apache.calcite.rex.RexLiteral; import org.apache.calcite.rex.RexNode; import org.apache.calcite.rex.RexUtil; -import org.apache.calcite.sql.SqlKind; import org.apache.calcite.tools.RelBuilderFactory; -import org.apache.calcite.util.Sarg; public class PinotFilterExpandSearchRule extends RelOptRule { @@ -48,13 +44,7 @@ public boolean matches(RelOptRuleCall call) { } if (call.rel(0) instanceof Filter) { Filter filter = call.rel(0); - if (filter.getCondition().getKind() == SqlKind.SEARCH) { - RexCall rexCall = (RexCall) filter.getCondition(); - List operands = rexCall.getOperands(); - RexLiteral rexLiteral = (RexLiteral) operands.get(1); - Sarg sarg = rexLiteral.getValueAs(Sarg.class); - return sarg != null && !sarg.isPoints() && !sarg.isComplementedPoints(); - } + return containsRangeSearch(filter.getCondition()); } return false; } @@ -65,4 +55,21 @@ public void onMatch(RelOptRuleCall call) { RexNode newCondition = RexUtil.expandSearch(filter.getCluster().getRexBuilder(), null, filter.getCondition()); call.transformTo(LogicalFilter.create(filter.getInput(), newCondition)); } + + private boolean containsRangeSearch(RexNode condition) { + switch (condition.getKind()) { + case AND: + case OR: + for (RexNode operand : ((RexCall) condition).getOperands()) { + if (containsRangeSearch(operand)) { + return true; + } + } + return false; + case SEARCH: + return true; + default: + return false; + } + } } 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 17a1d3a38142..0cb7b47a75b6 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 @@ -204,6 +204,9 @@ private Object[][] provideTestSql() { new Object[]{"SELECT a.col1, b.col2 FROM a JOIN b ON a.col1 = b.col1 " + " WHERE a.col3 IN (1, 2, 3) OR (a.col3 > 10 AND a.col3 < 50)"}, + new Object[]{"SELECT col1, SUM(col3) FROM a WHERE a.col3 BETWEEN 23 AND 36 " + + " GROUP BY col1 HAVING SUM(col3) > 10.0 AND MIN(col3) <> 123 AND MAX(col3) BETWEEN 10 AND 20"}, + // Projection pushdown new Object[]{"SELECT a.col1, a.col3 + a.col3 FROM a WHERE a.col3 >= 0 AND a.col2 = 'alice'"}, From c683894328ec00d6bc79ad397c5523b1a6286af1 Mon Sep 17 00:00:00 2001 From: Rong Rong Date: Wed, 21 Sep 2022 13:18:37 -0700 Subject: [PATCH 5/7] fix exception test --- .../test/java/org/apache/pinot/query/QueryCompilationTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/pinot-query-planner/src/test/java/org/apache/pinot/query/QueryCompilationTest.java b/pinot-query-planner/src/test/java/org/apache/pinot/query/QueryCompilationTest.java index 4223a1717a66..0531cfaba856 100644 --- a/pinot-query-planner/src/test/java/org/apache/pinot/query/QueryCompilationTest.java +++ b/pinot-query-planner/src/test/java/org/apache/pinot/query/QueryCompilationTest.java @@ -257,8 +257,6 @@ private Object[][] provideQueriesWithException() { new Object[]{"SELECT a.col1, SUM(a.col3) FROM a", "'a.col1' is not being grouped"}, // empty IN clause fails compilation new Object[]{"SELECT a.col1 FROM a WHERE a.col1 IN ()", "Encountered \"\" at line"}, - // range filter queries are not supported right now - new Object[]{"SELECT a.col1 FROM a WHERE a.col1 > 'x' AND a.col1 < 'y'", "Range is not implemented yet"} }; } From 4ae1067a59186d33d60f14812d2b9c0cb2842108 Mon Sep 17 00:00:00 2001 From: Rong Rong Date: Wed, 21 Sep 2022 17:03:44 -0700 Subject: [PATCH 6/7] also add empty literal optimized query node --- .../planner/logical/RelToStageConverter.java | 10 ++- .../pinot/query/planner/stage/ValueNode.java | 54 +++++++++++++ .../runtime/executor/WorkerQueryExecutor.java | 4 + .../operator/LiteralValueOperator.java | 79 +++++++++++++++++++ .../pinot/query/runtime/QueryRunnerTest.java | 3 + 5 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 pinot-query-planner/src/main/java/org/apache/pinot/query/planner/stage/ValueNode.java create mode 100644 pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/LiteralValueOperator.java diff --git a/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/RelToStageConverter.java b/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/RelToStageConverter.java index 8dddf7a4417a..76015f38c81f 100644 --- a/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/RelToStageConverter.java +++ b/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/RelToStageConverter.java @@ -31,6 +31,7 @@ import org.apache.calcite.rel.logical.LogicalProject; import org.apache.calcite.rel.logical.LogicalSort; import org.apache.calcite.rel.logical.LogicalTableScan; +import org.apache.calcite.rel.logical.LogicalValues; import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.rel.type.RelDataTypeField; import org.apache.calcite.rel.type.RelRecordType; @@ -45,6 +46,7 @@ import org.apache.pinot.query.planner.stage.SortNode; import org.apache.pinot.query.planner.stage.StageNode; import org.apache.pinot.query.planner.stage.TableScanNode; +import org.apache.pinot.query.planner.stage.ValueNode; /** @@ -77,11 +79,17 @@ public static StageNode toStageNode(RelNode node, int currentStageId) { return convertLogicalAggregate((LogicalAggregate) node, currentStageId); } else if (node instanceof LogicalSort) { return convertLogicalSort((LogicalSort) node, currentStageId); + } else if (node instanceof LogicalValues) { + return convertLogicalValues((LogicalValues) node, currentStageId); } else { - throw new UnsupportedOperationException("Unsupported logical plan node: " + node); + throw new UnsupportedOperationException("Unsupported logical plan node: " + node); } } + private static StageNode convertLogicalValues(LogicalValues node, int currentStageId) { + return new ValueNode(currentStageId, toDataSchema(node.getRowType()), node.tuples); + } + private static StageNode convertLogicalSort(LogicalSort node, int currentStageId) { int fetch = node.fetch == null ? 0 : ((RexLiteral) node.fetch).getValueAs(Integer.class); int offset = node.offset == null ? 0 : ((RexLiteral) node.offset).getValueAs(Integer.class); diff --git a/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/stage/ValueNode.java b/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/stage/ValueNode.java new file mode 100644 index 000000000000..082a4d3b36c9 --- /dev/null +++ b/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/stage/ValueNode.java @@ -0,0 +1,54 @@ +/** + * 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.query.planner.stage; + +import com.google.common.collect.ImmutableList; +import java.util.ArrayList; +import java.util.List; +import org.apache.calcite.rex.RexLiteral; +import org.apache.pinot.common.utils.DataSchema; +import org.apache.pinot.query.planner.logical.RexExpression; +import org.apache.pinot.query.planner.serde.ProtoProperties; + + +public class ValueNode extends AbstractStageNode { + @ProtoProperties + private List> _literalRows; + + public ValueNode(int stageId) { + super(stageId); + } + + public ValueNode(int currentStageId, DataSchema dataSchema, + ImmutableList> literalTuples) { + super(currentStageId, dataSchema); + _literalRows = new ArrayList<>(); + for (List literalTuple : literalTuples) { + List literalRow = new ArrayList<>(); + for (RexLiteral literal : literalTuple) { + literalRow.add(RexExpression.toRexExpression(literal)); + } + _literalRows.add(literalRow); + } + } + + public List> getLiteralRows() { + return _literalRows; + } +} diff --git a/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/executor/WorkerQueryExecutor.java b/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/executor/WorkerQueryExecutor.java index 58d5371691b7..95744c55a00d 100644 --- a/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/executor/WorkerQueryExecutor.java +++ b/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/executor/WorkerQueryExecutor.java @@ -37,11 +37,13 @@ import org.apache.pinot.query.planner.stage.ProjectNode; import org.apache.pinot.query.planner.stage.SortNode; import org.apache.pinot.query.planner.stage.StageNode; +import org.apache.pinot.query.planner.stage.ValueNode; import org.apache.pinot.query.runtime.blocks.TransferableBlock; import org.apache.pinot.query.runtime.blocks.TransferableBlockUtils; import org.apache.pinot.query.runtime.operator.AggregateOperator; import org.apache.pinot.query.runtime.operator.FilterOperator; import org.apache.pinot.query.runtime.operator.HashJoinOperator; +import org.apache.pinot.query.runtime.operator.LiteralValueOperator; import org.apache.pinot.query.runtime.operator.MailboxReceiveOperator; import org.apache.pinot.query.runtime.operator.MailboxSendOperator; import org.apache.pinot.query.runtime.operator.SortOperator; @@ -144,6 +146,8 @@ private BaseOperator getOperator(long requestId, StageNode st return new SortOperator(getOperator(requestId, sortNode.getInputs().get(0), metadataMap), sortNode.getCollationKeys(), sortNode.getCollationDirections(), sortNode.getFetch(), sortNode.getOffset(), sortNode.getDataSchema()); + } else if (stageNode instanceof ValueNode) { + return new LiteralValueOperator(stageNode.getDataSchema(), ((ValueNode) stageNode).getLiteralRows()); } else { throw new UnsupportedOperationException( String.format("Stage node type %s is not supported!", stageNode.getClass().getSimpleName())); diff --git a/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/LiteralValueOperator.java b/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/LiteralValueOperator.java new file mode 100644 index 000000000000..9ded3df8f2f7 --- /dev/null +++ b/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/LiteralValueOperator.java @@ -0,0 +1,79 @@ +/** + * 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.query.runtime.operator; + +import java.util.ArrayList; +import java.util.List; +import javax.annotation.Nullable; +import org.apache.pinot.common.utils.DataSchema; +import org.apache.pinot.core.common.Operator; +import org.apache.pinot.core.common.datablock.BaseDataBlock; +import org.apache.pinot.core.operator.BaseOperator; +import org.apache.pinot.query.planner.logical.RexExpression; +import org.apache.pinot.query.runtime.blocks.TransferableBlock; +import org.apache.pinot.query.runtime.blocks.TransferableBlockUtils; + + +public class LiteralValueOperator extends BaseOperator { + private static final String EXPLAIN_NAME = "LITERAL_VALUE_PROVIDER"; + + private final DataSchema _dataSchema; + private final TransferableBlock _rexLiteralBlock; + private boolean _isLiteralBlockReturned; + + public LiteralValueOperator(DataSchema dataSchema, List> rexLiteralRows) { + _dataSchema = dataSchema; + _rexLiteralBlock = constructBlock(rexLiteralRows); + _isLiteralBlockReturned = false; + } + + @Override + public List getChildOperators() { + // WorkerExecutor doesn't use getChildOperators, returns null here. + return null; + } + + @Nullable + @Override + public String toExplainString() { + return EXPLAIN_NAME; + } + + @Override + protected TransferableBlock getNextBlock() { + if (!_isLiteralBlockReturned) { + _isLiteralBlockReturned = true; + return _rexLiteralBlock; + } else { + return TransferableBlockUtils.getEndOfStreamTransferableBlock(_dataSchema); + } + } + + private TransferableBlock constructBlock(List> rexLiteralRows) { + List blockContent = new ArrayList<>(); + for (List rexLiteralRow : rexLiteralRows) { + Object[] row = new Object[_dataSchema.size()]; + for (int i = 0; i < _dataSchema.size(); i++) { + row[i] = ((RexExpression.Literal) rexLiteralRow.get(i)).getValue(); + } + blockContent.add(row); + } + return new TransferableBlock(blockContent, _dataSchema, BaseDataBlock.Type.ROW); + } +} 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 0cb7b47a75b6..0aeecd58cf37 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 @@ -207,6 +207,9 @@ private Object[][] provideTestSql() { new Object[]{"SELECT col1, SUM(col3) FROM a WHERE a.col3 BETWEEN 23 AND 36 " + " GROUP BY col1 HAVING SUM(col3) > 10.0 AND MIN(col3) <> 123 AND MAX(col3) BETWEEN 10 AND 20"}, + new Object[]{"SELECT col1, SUM(col3) FROM a WHERE (col3 > 0 AND col3 < 45) AND (col3 > 15 AND col3 < 50) " + + " GROUP BY col1 HAVING (SUM(col3) > 10 AND SUM(col3) < 20) AND (SUM(col3) > 30 AND SUM(col3) < 40)"}, + // Projection pushdown new Object[]{"SELECT a.col1, a.col3 + a.col3 FROM a WHERE a.col3 >= 0 AND a.col2 = 'alice'"}, From 9a268b120d81d5553d56945be664ad0594e8e4e6 Mon Sep 17 00:00:00 2001 From: Rong Rong Date: Thu, 22 Sep 2022 14:47:33 -0700 Subject: [PATCH 7/7] also fix serde issue --- .../apache/pinot/query/planner/stage/StageNodeSerDeUtils.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/stage/StageNodeSerDeUtils.java b/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/stage/StageNodeSerDeUtils.java index 4e8e1c4e614c..69de8bcba688 100644 --- a/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/stage/StageNodeSerDeUtils.java +++ b/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/stage/StageNodeSerDeUtils.java @@ -81,6 +81,8 @@ private static AbstractStageNode newNodeInstance(String nodeName, int stageId) { return new MailboxSendNode(stageId); case "MailboxReceiveNode": return new MailboxReceiveNode(stageId); + case "ValueNode": + return new ValueNode(stageId); default: throw new IllegalArgumentException("Unknown node name: " + nodeName); }