-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1307 from kuzudb/factorization-rewriter
Factorization rewriter
- Loading branch information
Showing
49 changed files
with
878 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include "planner/logical_plan/logical_plan.h" | ||
|
||
namespace kuzu { | ||
namespace optimizer { | ||
|
||
class FactorizationRewriter { | ||
public: | ||
void rewrite(planner::LogicalPlan* plan); | ||
|
||
private: | ||
void visitOperator(planner::LogicalOperator* op); | ||
void visitExtend(planner::LogicalOperator* op); | ||
void visitHashJoin(planner::LogicalOperator* op); | ||
void visitIntersect(planner::LogicalOperator* op); | ||
void visitProjection(planner::LogicalOperator* op); | ||
void visitAggregate(planner::LogicalOperator* op); | ||
void visitOrderBy(planner::LogicalOperator* op); | ||
void visitSkip(planner::LogicalOperator* op); | ||
void visitLimit(planner::LogicalOperator* op); | ||
void visitDistinct(planner::LogicalOperator* op); | ||
void visitUnwind(planner::LogicalOperator* op); | ||
void visitUnion(planner::LogicalOperator* op); | ||
void visitFilter(planner::LogicalOperator* op); | ||
void visitSetNodeProperty(planner::LogicalOperator* op); | ||
void visitSetRelProperty(planner::LogicalOperator* op); | ||
void visitDeleteRel(planner::LogicalOperator* op); | ||
void visitCreateNode(planner::LogicalOperator* op); | ||
void visitCreateRel(planner::LogicalOperator* op); | ||
|
||
std::shared_ptr<planner::LogicalOperator> appendFlattens( | ||
std::shared_ptr<planner::LogicalOperator> op, | ||
const std::unordered_set<planner::f_group_pos>& groupsPos); | ||
std::shared_ptr<planner::LogicalOperator> appendFlattenIfNecessary( | ||
std::shared_ptr<planner::LogicalOperator> op, planner::f_group_pos groupPos); | ||
}; | ||
|
||
} // namespace optimizer | ||
} // namespace kuzu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "planner/logical_plan/logical_plan.h" | ||
|
||
namespace kuzu { | ||
namespace optimizer { | ||
|
||
class RemoveFactorizationRewriter { | ||
public: | ||
void rewrite(planner::LogicalPlan* plan); | ||
|
||
private: | ||
std::shared_ptr<planner::LogicalOperator> rewriteOperator( | ||
std::shared_ptr<planner::LogicalOperator> op); | ||
|
||
bool subPlanHasFlatten(planner::LogicalOperator* op); | ||
}; | ||
|
||
} // namespace optimizer | ||
} // namespace kuzu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/include/planner/logical_plan/logical_operator/flatten_resolver.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
|
||
#include "planner/logical_plan/logical_operator/base_logical_operator.h" | ||
|
||
namespace kuzu { | ||
namespace planner { | ||
namespace factorization { | ||
|
||
struct FlattenAllButOne { | ||
static f_group_pos_set getGroupsPosToFlatten(const f_group_pos_set& groupsPos, Schema* schema); | ||
}; | ||
|
||
struct FlattenAll { | ||
static f_group_pos_set getGroupsPosToFlatten(const f_group_pos_set& groupsPos, Schema* schema); | ||
}; | ||
|
||
} // namespace factorization | ||
} // namespace planner | ||
} // namespace kuzu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.