diff --git a/src/graph/optimizer/rule/EliminateFilterRule.cpp b/src/graph/optimizer/rule/EliminateFilterRule.cpp index f38661bf893..d5b6afcc6a5 100644 --- a/src/graph/optimizer/rule/EliminateFilterRule.cpp +++ b/src/graph/optimizer/rule/EliminateFilterRule.cpp @@ -53,14 +53,13 @@ StatusOr EliminateFilterRule::transform( auto filterGroupNode = matched.node; auto filter = static_cast(filterGroupNode->node()); - auto newValue = ValueNode::make(octx->qctx(), nullptr, DataSet(filter->colNames())); - newValue->setOutputVar(filter->outputVar()); - auto newValueGroupNode = OptGroupNode::create(octx, newValue, filterGroupNode->group()); - auto newStart = StartNode::make(octx->qctx()); auto newStartGroup = OptGroup::create(octx); newStartGroup->makeGroupNode(newStart); + auto newValue = ValueNode::make(octx->qctx(), newStart, DataSet(filter->colNames())); + newValue->setOutputVar(filter->outputVar()); + auto newValueGroupNode = OptGroupNode::create(octx, newValue, filterGroupNode->group()); newValueGroupNode->dependsOn(newStartGroup); TransformResult result; diff --git a/src/graph/planner/plan/Query.cpp b/src/graph/planner/plan/Query.cpp index a33b41cf750..9ee98a9c4c6 100644 --- a/src/graph/planner/plan/Query.cpp +++ b/src/graph/planner/plan/Query.cpp @@ -1083,5 +1083,9 @@ std::unique_ptr FulltextIndexScan::explain() const { return desc; } +PlanNode* ValueNode::clone() const { + return ValueNode::make(qctx_, nullptr, value_); +} + } // namespace graph } // namespace nebula diff --git a/src/graph/planner/plan/Query.h b/src/graph/planner/plan/Query.h index ded3d16f2a6..4ab44ceacce 100644 --- a/src/graph/planner/plan/Query.h +++ b/src/graph/planner/plan/Query.h @@ -2059,6 +2059,8 @@ class ValueNode : public SingleInputNode { return qctx->objPool()->makeAndAdd(qctx, dep, std::move(value)); } + PlanNode* clone() const override; + Value value() const { return value_; } diff --git a/tests/tck/features/optimizer/ElimintateInvalidProp.feature b/tests/tck/features/optimizer/ElimintateInvalidProp.feature index 96656a74a2c..4545065b480 100644 --- a/tests/tck/features/optimizer/ElimintateInvalidProp.feature +++ b/tests/tck/features/optimizer/ElimintateInvalidProp.feature @@ -35,3 +35,13 @@ Feature: Eliminate invalid property filter | 0 | Project | 1 | | | 1 | Value | 2 | | | 2 | Start | | | + + Scenario: Elimintate Empty value + When executing query: + """ + MATCH (a2:player) WHERE 28==0.63 + MATCH (b)-[e4]->(a2) WHERE 18 <= a2.player.age + RETURN a2 + """ + Then the result should be, in any order: + | a2 |