Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
Add full index scan rules into default ruleset in optimizer (#1205)
Browse files Browse the repository at this point in the history
  • Loading branch information
yixinglu committed Jul 6, 2021
1 parent 39d6bbb commit b52a335
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/optimizer/OptimizerUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,7 @@ bool OptimizerUtils::findOptimalIndex(const Expression* condition,
}
break;
}
// The filter can always be pushed down for lookup query
if (iter != index.hints.end() || !index.unusedExprs.empty()) {
ictx->set_filter(condition->encode());
}
Expand Down
2 changes: 1 addition & 1 deletion src/optimizer/rule/EdgeIndexFullScanRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ std::unique_ptr<OptRule> EdgeIndexFullScanRule::kInstance =
std::unique_ptr<EdgeIndexFullScanRule>(new EdgeIndexFullScanRule());

EdgeIndexFullScanRule::EdgeIndexFullScanRule() {
RuleSet::QueryRules().addRule(this);
RuleSet::DefaultRules().addRule(this);
}

const Pattern& EdgeIndexFullScanRule::pattern() const {
Expand Down
2 changes: 1 addition & 1 deletion src/optimizer/rule/PushFilterDownEdgeIndexScanRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ std::unique_ptr<OptRule> PushFilterDownEdgeIndexScanRule::kInstance =
std::unique_ptr<PushFilterDownEdgeIndexScanRule>(new PushFilterDownEdgeIndexScanRule());

PushFilterDownEdgeIndexScanRule::PushFilterDownEdgeIndexScanRule() {
RuleSet::QueryRules().addRule(this);
RuleSet::DefaultRules().addRule(this);
}

const Pattern& PushFilterDownEdgeIndexScanRule::pattern() const {
Expand Down
3 changes: 3 additions & 0 deletions src/optimizer/rule/PushFilterDownEdgeIndexScanRule.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
namespace nebula {
namespace opt {

// At present, we do NOT split filter conditions into two parts, one part is pushed down storage
// layer and another will be leaved into filter. Because this is enough for Lookup queries. We
// will enhance this rule for general usage later, such as MATCH queries.
class PushFilterDownEdgeIndexScanRule final : public OptRule {
public:
const Pattern &pattern() const override;
Expand Down
2 changes: 1 addition & 1 deletion src/optimizer/rule/PushFilterDownTagIndexScanRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ std::unique_ptr<OptRule> PushFilterDownTagIndexScanRule::kInstance =
std::unique_ptr<PushFilterDownTagIndexScanRule>(new PushFilterDownTagIndexScanRule());

PushFilterDownTagIndexScanRule::PushFilterDownTagIndexScanRule() {
RuleSet::QueryRules().addRule(this);
RuleSet::DefaultRules().addRule(this);
}

const Pattern& PushFilterDownTagIndexScanRule::pattern() const {
Expand Down
3 changes: 3 additions & 0 deletions src/optimizer/rule/PushFilterDownTagIndexScanRule.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
namespace nebula {
namespace opt {

// At present, we do NOT split filter conditions into two parts, one part is pushed down storage
// layer and another will be leaved into filter. Because this is enough for Lookup queries. We
// will enhance this rule for general usage later, such as MATCH queries.
class PushFilterDownTagIndexScanRule final : public OptRule {
public:
const Pattern &pattern() const override;
Expand Down
2 changes: 1 addition & 1 deletion src/optimizer/rule/TagIndexFullScanRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ std::unique_ptr<OptRule> TagIndexFullScanRule::kInstance =
std::unique_ptr<TagIndexFullScanRule>(new TagIndexFullScanRule());

TagIndexFullScanRule::TagIndexFullScanRule() {
RuleSet::QueryRules().addRule(this);
RuleSet::DefaultRules().addRule(this);
}

const Pattern& TagIndexFullScanRule::pattern() const {
Expand Down
2 changes: 1 addition & 1 deletion src/optimizer/rule/UnionAllEdgeIndexScanRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ std::unique_ptr<OptRule> UnionAllEdgeIndexScanRule::kInstance =
std::unique_ptr<UnionAllEdgeIndexScanRule>(new UnionAllEdgeIndexScanRule());

UnionAllEdgeIndexScanRule::UnionAllEdgeIndexScanRule() {
RuleSet::QueryRules().addRule(this);
RuleSet::DefaultRules().addRule(this);
}

const Pattern& UnionAllEdgeIndexScanRule::pattern() const {
Expand Down
2 changes: 1 addition & 1 deletion src/optimizer/rule/UnionAllTagIndexScanRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ std::unique_ptr<OptRule> UnionAllTagIndexScanRule::kInstance =
std::unique_ptr<UnionAllTagIndexScanRule>(new UnionAllTagIndexScanRule());

UnionAllTagIndexScanRule::UnionAllTagIndexScanRule() {
RuleSet::QueryRules().addRule(this);
RuleSet::DefaultRules().addRule(this);
}

const Pattern& UnionAllTagIndexScanRule::pattern() const {
Expand Down

0 comments on commit b52a335

Please sign in to comment.