-
Notifications
You must be signed in to change notification settings - Fork 106
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 #1560 from kuzudb/extend-direction
Refactor extend direction & rel data direction
- Loading branch information
Showing
26 changed files
with
220 additions
and
115 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include "common/rel_direction.h" | ||
|
||
#include "common/exception.h" | ||
|
||
namespace kuzu { | ||
namespace common { | ||
|
||
std::string RelDataDirectionUtils::relDataDirectionToString(RelDataDirection direction) { | ||
switch (direction) { | ||
case RelDataDirection::FWD: { | ||
return "forward"; | ||
} | ||
case RelDataDirection::BWD: { | ||
return "backward"; | ||
} | ||
default: | ||
throw NotImplementedException("RelDataDirectionUtils::relDataDirectionToString"); | ||
} | ||
} | ||
|
||
} // 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
#include <string> | ||
#include <vector> | ||
|
||
namespace kuzu { | ||
namespace common { | ||
|
||
enum RelDataDirection : uint8_t { FWD = 0, BWD = 1 }; | ||
|
||
struct RelDataDirectionUtils { | ||
static inline std::vector<RelDataDirection> getRelDataDirections() { | ||
return std::vector<RelDataDirection>{RelDataDirection::FWD, RelDataDirection::BWD}; | ||
} | ||
|
||
static std::string relDataDirectionToString(RelDataDirection direction); | ||
}; | ||
|
||
} // 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
34 changes: 34 additions & 0 deletions
34
src/include/planner/logical_plan/logical_operator/extend_direction.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,34 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
|
||
#include "binder/expression/rel_expression.h" | ||
#include "common/rel_direction.h" | ||
|
||
namespace kuzu { | ||
namespace planner { | ||
|
||
enum class ExtendDirection : uint8_t { FWD = 0, BWD = 1, BOTH = 2 }; | ||
|
||
struct ExtendDirectionUtils { | ||
static inline ExtendDirection getExtendDirection( | ||
const binder::RelExpression& relExpression, const binder::NodeExpression& boundNode) { | ||
if (relExpression.getDirectionType() == binder::RelDirectionType::BOTH) { | ||
return ExtendDirection::BOTH; | ||
} | ||
if (relExpression.getSrcNodeName() == boundNode.getUniqueName()) { | ||
return ExtendDirection::FWD; | ||
} else { | ||
return ExtendDirection::BWD; | ||
} | ||
} | ||
|
||
static inline common::RelDataDirection getRelDataDirection(ExtendDirection extendDirection) { | ||
assert(extendDirection != ExtendDirection::BOTH); | ||
return extendDirection == ExtendDirection::FWD ? common::RelDataDirection::FWD : | ||
common::RelDataDirection::BWD; | ||
} | ||
}; | ||
|
||
} // 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
Oops, something went wrong.