-
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 branch 'master' into shortestpath
- Loading branch information
Showing
36 changed files
with
3,043 additions
and
2,662 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
|
||
namespace kuzu { | ||
namespace common { | ||
|
||
enum class QueryRelType : uint8_t { | ||
NON_RECURSIVE = 0, | ||
VARIABLE_LENGTH = 1, | ||
SHORTEST = 2, | ||
}; | ||
|
||
} // namespace common | ||
} // 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
35 changes: 35 additions & 0 deletions
35
src/include/planner/logical_plan/logical_operator/base_logical_extend.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,35 @@ | ||
#pragma once | ||
|
||
#include "base_logical_operator.h" | ||
#include "binder/expression/rel_expression.h" | ||
|
||
namespace kuzu { | ||
namespace planner { | ||
|
||
class BaseLogicalExtend : public LogicalOperator { | ||
public: | ||
BaseLogicalExtend(LogicalOperatorType operatorType, | ||
std::shared_ptr<binder::NodeExpression> boundNode, | ||
std::shared_ptr<binder::NodeExpression> nbrNode, std::shared_ptr<binder::RelExpression> rel, | ||
common::RelDirection direction, std::shared_ptr<LogicalOperator> child) | ||
: LogicalOperator{operatorType, std::move(child)}, boundNode{std::move(boundNode)}, | ||
nbrNode{std::move(nbrNode)}, rel{std::move(rel)}, direction{direction} {} | ||
|
||
inline std::shared_ptr<binder::NodeExpression> getBoundNode() const { return boundNode; } | ||
inline std::shared_ptr<binder::NodeExpression> getNbrNode() const { return nbrNode; } | ||
inline std::shared_ptr<binder::RelExpression> getRel() const { return rel; } | ||
inline common::RelDirection getDirection() const { return direction; } | ||
|
||
virtual f_group_pos_set getGroupsPosToFlatten() = 0; | ||
|
||
std::string getExpressionsForPrinting() const override; | ||
|
||
protected: | ||
std::shared_ptr<binder::NodeExpression> boundNode; | ||
std::shared_ptr<binder::NodeExpression> nbrNode; | ||
std::shared_ptr<binder::RelExpression> rel; | ||
common::RelDirection direction; | ||
}; | ||
|
||
} // 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
36 changes: 10 additions & 26 deletions
36
src/include/planner/logical_plan/logical_operator/logical_extend.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
61 changes: 61 additions & 0 deletions
61
src/include/planner/logical_plan/logical_operator/logical_recursive_extend.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,61 @@ | ||
#pragma once | ||
|
||
#include "base_logical_extend.h" | ||
|
||
namespace kuzu { | ||
namespace planner { | ||
|
||
// TODO(Xiyang): we should have a single LogicalRecursiveExtend once we migrate VariableLengthExtend | ||
// to use the same infrastructure as shortest path. | ||
class LogicalRecursiveExtend : public BaseLogicalExtend { | ||
public: | ||
LogicalRecursiveExtend(std::shared_ptr<binder::NodeExpression> boundNode, | ||
std::shared_ptr<binder::NodeExpression> nbrNode, std::shared_ptr<binder::RelExpression> rel, | ||
common::RelDirection direction, std::shared_ptr<LogicalOperator> child) | ||
: BaseLogicalExtend{LogicalOperatorType::RECURSIVE_EXTEND, std::move(boundNode), | ||
std::move(nbrNode), std::move(rel), direction, std::move(child)} {} | ||
|
||
f_group_pos_set getGroupsPosToFlatten() override; | ||
|
||
void computeFlatSchema() override; | ||
}; | ||
|
||
class LogicalVariableLengthExtend : public LogicalRecursiveExtend { | ||
public: | ||
LogicalVariableLengthExtend(std::shared_ptr<binder::NodeExpression> boundNode, | ||
std::shared_ptr<binder::NodeExpression> nbrNode, std::shared_ptr<binder::RelExpression> rel, | ||
common::RelDirection direction, bool hasAtMostOneNbr, | ||
std::shared_ptr<LogicalOperator> child) | ||
: LogicalRecursiveExtend{std::move(boundNode), std::move(nbrNode), std::move(rel), | ||
direction, std::move(child)}, | ||
hasAtMostOneNbr{hasAtMostOneNbr} {} | ||
|
||
void computeFactorizedSchema() override; | ||
|
||
inline std::unique_ptr<LogicalOperator> copy() override { | ||
return std::make_unique<LogicalVariableLengthExtend>( | ||
boundNode, nbrNode, rel, direction, hasAtMostOneNbr, children[0]->copy()); | ||
} | ||
|
||
private: | ||
bool hasAtMostOneNbr; | ||
}; | ||
|
||
class LogicalShortestPathExtend : public LogicalRecursiveExtend { | ||
public: | ||
LogicalShortestPathExtend(std::shared_ptr<binder::NodeExpression> boundNode, | ||
std::shared_ptr<binder::NodeExpression> nbrNode, std::shared_ptr<binder::RelExpression> rel, | ||
common::RelDirection direction, std::shared_ptr<LogicalOperator> child) | ||
: LogicalRecursiveExtend{std::move(boundNode), std::move(nbrNode), std::move(rel), | ||
direction, std::move(child)} {} | ||
|
||
void computeFactorizedSchema() override; | ||
|
||
inline std::unique_ptr<LogicalOperator> copy() override { | ||
return std::make_unique<LogicalShortestPathExtend>( | ||
boundNode, nbrNode, rel, direction, children[0]->copy()); | ||
} | ||
}; | ||
|
||
} // 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
Oops, something went wrong.