Skip to content

Commit

Permalink
remove useless dc
Browse files Browse the repository at this point in the history
  • Loading branch information
jievince committed Aug 17, 2022
1 parent 0f75120 commit f343f42
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 71 deletions.
26 changes: 0 additions & 26 deletions src/graph/planner/SequentialPlanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ bool SequentialPlanner::match(AstContext* astCtx) {
StatusOr<SubPlan> SequentialPlanner::transform(AstContext* astCtx) {
SubPlan subPlan;
auto* seqCtx = static_cast<SequentialAstContext*>(astCtx);
auto* qctx = seqCtx->qctx;
const auto& validators = seqCtx->validators;
subPlan.root = validators.back()->root();
ifBuildDataCollect(subPlan, qctx);
for (auto iter = validators.begin(); iter < validators.end() - 1; ++iter) {
// Remove left tail kStart plannode before append plan.
// It allows that kUse sentence to append kMatch Sentence.
Expand All @@ -40,30 +38,6 @@ StatusOr<SubPlan> SequentialPlanner::transform(AstContext* astCtx) {
return subPlan;
}

void SequentialPlanner::ifBuildDataCollect(SubPlan& subPlan, QueryContext* qctx) {
switch (subPlan.root->kind()) {
case PlanNode::Kind::kSort:
case PlanNode::Kind::kLimit:
case PlanNode::Kind::kSample:
case PlanNode::Kind::kDedup:
case PlanNode::Kind::kUnion:
case PlanNode::Kind::kUnionAllVersionVar:
case PlanNode::Kind::kIntersect:
case PlanNode::Kind::kCartesianProduct:
case PlanNode::Kind::kMinus:
case PlanNode::Kind::kFilter: {
auto* dc = DataCollect::make(qctx, DataCollect::DCKind::kRowBasedMove);
dc->addDep(subPlan.root);
dc->setInputVars({subPlan.root->outputVar()});
dc->setColNames(subPlan.root->colNames());
subPlan.root = dc;
break;
}
default:
break;
}
}

// When appending plans, it need to remove left tail plannode.
// Because the left tail plannode is StartNode which needs to be removed,
// and remain one size for add dependency
Expand Down
2 changes: 0 additions & 2 deletions src/graph/planner/SequentialPlanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ class SequentialPlanner final : public Planner {
*/
StatusOr<SubPlan> transform(AstContext* astCtx) override;

void ifBuildDataCollect(SubPlan& subPlan, QueryContext* qctx);

void rmLeftTailStartNode(Validator* validator, Sentence::Kind appendPlanKind);

private:
Expand Down
9 changes: 1 addition & 8 deletions tests/tck/features/lookup/LookUpLimit.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
@czp
Feature: Push Limit down IndexScan Rule

Background:
Expand All @@ -17,7 +18,6 @@ Feature: Push Limit down IndexScan Rule
| /[a-zA-Z ']+/ |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | Sort | 6 | |
| 6 | Project | 7 | |
| 7 | Limit | 8 | {"count": "2"} |
Expand All @@ -33,7 +33,6 @@ Feature: Push Limit down IndexScan Rule
| /[a-zA-Z ']+/ | /[a-zA-Z ']+/ | /\d+/ |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | Sort | 6 | |
| 6 | Project | 7 | |
| 7 | Limit | 8 | {"count": "2"} |
Expand All @@ -49,7 +48,6 @@ Feature: Push Limit down IndexScan Rule
| /[a-zA-Z ']+/ |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | Sort | 6 | |
| 6 | Project | 7 | |
| 7 | Limit | 8 | {"count": "2"} |
Expand All @@ -65,7 +63,6 @@ Feature: Push Limit down IndexScan Rule
| /[a-zA-Z ']+/ | /[a-zA-Z ']+/ | /\d+/ |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | Sort | 6 | |
| 6 | Project | 7 | |
| 7 | Limit | 8 | {"count": "2"} |
Expand All @@ -84,7 +81,6 @@ Feature: Push Limit down IndexScan Rule
| /[a-zA-Z ']+/ |
And the execution plan should be:
| id | name | dependencies | operator info |
| 3 | DataCollect | 4 | |
| 4 | Sort | 5 | |
| 5 | Project | 7 | |
| 7 | Limit | 8 | |
Expand All @@ -101,7 +97,6 @@ Feature: Push Limit down IndexScan Rule
| /[a-zA-Z ']+/ | /[a-zA-Z ']+/ | /\d+/ |
And the execution plan should be:
| id | name | dependencies | operator info |
| 3 | DataCollect | 4 | |
| 4 | Sort | 5 | |
| 5 | Project | 7 | |
| 7 | Limit | 8 | |
Expand All @@ -118,7 +113,6 @@ Feature: Push Limit down IndexScan Rule
| /[a-zA-Z ']+/ |
And the execution plan should be:
| id | name | dependencies | operator info |
| 3 | DataCollect | 4 | |
| 4 | Sort | 5 | |
| 5 | Project | 7 | |
| 7 | Limit | 8 | |
Expand All @@ -135,7 +129,6 @@ Feature: Push Limit down IndexScan Rule
| /[a-zA-Z ']+/ | /[a-zA-Z ']+/ | /\d+/ |
And the execution plan should be:
| id | name | dependencies | operator info |
| 3 | DataCollect | 4 | |
| 4 | Sort | 5 | |
| 5 | Project | 7 | |
| 7 | Limit | 8 | |
Expand Down
23 changes: 1 addition & 22 deletions tests/tck/features/lookup/LookUpTopN.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
@czp
Feature: Push TopN down IndexScan Rule

Background:
Expand All @@ -17,14 +18,12 @@ Feature: Push TopN down IndexScan Rule
| "Aron Baynes" |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | {"count": "2"} |
| 6 | Project | 7 | |
| 7 | TagIndexFullScan | 0 | {"limit": "9223372036854775807" } |
| 0 | Start | | |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | |
| 6 | Project | 7 | |
| 7 | TagIndexFullScan | 0 | {"orderBy": "[]"} |
Expand All @@ -39,14 +38,12 @@ Feature: Push TopN down IndexScan Rule
| "DeAndre Jordan" |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | {"count": "2"} |
| 6 | Project | 7 | |
| 7 | TagIndexPrefixScan | 0 | {"limit": "9223372036854775807" } |
| 0 | Start | | |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | |
| 6 | Project | 7 | |
| 7 | TagIndexPrefixScan | 0 | {"orderBy": "[]"} |
Expand All @@ -61,14 +58,12 @@ Feature: Push TopN down IndexScan Rule
| "Tim Duncan" |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | {"count": "2"} |
| 6 | Project | 7 | |
| 7 | TagIndexRangeScan | 0 | {"limit": "9223372036854775807" } |
| 0 | Start | | |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | |
| 6 | Project | 7 | |
| 7 | TagIndexRangeScan | 0 | {"orderBy": "[]"} |
Expand All @@ -83,14 +78,12 @@ Feature: Push TopN down IndexScan Rule
| "Aron Baynes" |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | {"count": "2"} |
| 6 | Project | 7 | |
| 7 | TagIndexFullScan | 0 | {"limit": "9223372036854775807" } |
| 0 | Start | | |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | |
| 6 | Project | 7 | |
| 7 | TagIndexFullScan | 0 | {"orderBy": "[]"} |
Expand All @@ -105,14 +98,12 @@ Feature: Push TopN down IndexScan Rule
| "Aron Baynes" | "Tim Duncan" | 0 |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | {"count": "2"} |
| 6 | Project | 7 | |
| 7 | EdgeIndexFullScan | 0 | {"limit": "9223372036854775807" } |
| 0 | Start | | |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | |
| 6 | Project | 7 | |
| 7 | EdgeIndexFullScan | 0 | {"orderBy": "[]"} |
Expand All @@ -127,14 +118,12 @@ Feature: Push TopN down IndexScan Rule
| "Carmelo Anthony" | "Chris Paul" | 0 |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | {"count": "2"} |
| 6 | Project | 7 | |
| 7 | EdgeIndexPrefixScan | 0 | {"limit": "9223372036854775807" } |
| 0 | Start | | |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | |
| 6 | Project | 7 | |
| 7 | EdgeIndexPrefixScan | 0 | {"orderBy": "[]"} |
Expand All @@ -149,14 +138,12 @@ Feature: Push TopN down IndexScan Rule
| "Dejounte Murray" | "Chris Paul" | 0 |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | {"count": "2"} |
| 6 | Project | 7 | |
| 7 | EdgeIndexRangeScan | 0 | {"limit": "9223372036854775807" } |
| 0 | Start | | |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | |
| 6 | Project | 7 | |
| 7 | EdgeIndexRangeScan | 0 | {"orderBy": "[]"} |
Expand All @@ -173,7 +160,6 @@ Feature: Push TopN down IndexScan Rule
| "Aron Baynes" |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | {"count": "2"} |
| 6 | Project | 7 | |
| 7 | TagIndexFullScan | 0 | {"limit": "2" } |
Expand All @@ -188,7 +174,6 @@ Feature: Push TopN down IndexScan Rule
| "Kevin Durant" |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | {"count": "2"} |
| 6 | Project | 7 | |
| 7 | TagIndexPrefixScan | 0 | {"limit": "2" } |
Expand All @@ -203,7 +188,6 @@ Feature: Push TopN down IndexScan Rule
| "DeAndre Jordan" |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | {"count": "2"} |
| 6 | Project | 7 | |
| 7 | TagIndexPrefixScan | 0 | {"limit": "2" } |
Expand All @@ -218,7 +202,6 @@ Feature: Push TopN down IndexScan Rule
| "Tim Duncan" |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | {"count": "2"} |
| 6 | Project | 7 | |
| 7 | TagIndexRangeScan | 0 | {"limit": "2" } |
Expand All @@ -233,7 +216,6 @@ Feature: Push TopN down IndexScan Rule
| -1 |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | {"count": "2"} |
| 6 | Project | 7 | |
| 7 | EdgeIndexFullScan | 0 | {"limit": "2" } |
Expand All @@ -248,7 +230,6 @@ Feature: Push TopN down IndexScan Rule
| 100 |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | {"count": "2"} |
| 6 | Project | 7 | |
| 7 | EdgeIndexFullScan | 0 | {"limit": "2" } |
Expand All @@ -263,7 +244,6 @@ Feature: Push TopN down IndexScan Rule
| 90 |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | {"count": "2"} |
| 6 | Project | 7 | |
| 7 | EdgeIndexPrefixScan | 0 | {"limit": "2" } |
Expand All @@ -278,7 +258,6 @@ Feature: Push TopN down IndexScan Rule
| 95 |
And the execution plan should be:
| id | name | dependencies | operator info |
| 4 | DataCollect | 5 | |
| 5 | TopN | 6 | {"count": "2"} |
| 6 | Project | 7 | |
| 7 | EdgeIndexRangeScan | 0 | {"limit": "2" } |
Expand Down
2 changes: 1 addition & 1 deletion tests/tck/features/optimizer/CollapseProjectRule.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
@czp
Feature: Collapse Project Rule

Background:
Expand Down Expand Up @@ -95,7 +96,6 @@ Feature: Collapse Project Rule
| 29 | "Dejounte Murray" |
And the execution plan should be:
| id | name | dependencies | operator info |
| 11 | DataCollect | 10 | |
| 10 | Dedup | 14 | |
| 14 | Project | 12 | |
| 12 | Filter | 6 | |
Expand Down
Loading

0 comments on commit f343f42

Please sign in to comment.