Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
andyfengHKU committed Jun 25, 2023
1 parent 7fbbf3b commit fe87e5b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 19 deletions.
10 changes: 0 additions & 10 deletions src/binder/query/query_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,5 @@ expression_pair PropertyKeyValCollection::getKeyVal(
return propertyKeyValMap.at(variable).at(propertyName);
}

// std::vector<expression_pair> PropertyKeyValCollection::getAllPropertyKeyValPairs() const {
// std::vector<expression_pair> result;
// for (auto& [varName, keyValPairsMap] : varNameToPropertyKeyValPairs) {
// for (auto& [propertyName, keyValPairs] : keyValPairsMap) {
// result.push_back(keyValPairs);
// }
// }
// return result;
//}

} // namespace binder
} // namespace kuzu
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class ExistentialSubqueryExpression : public Expression {
}
inline bool hasWhereExpression() const { return whereExpression != nullptr; }
inline std::shared_ptr<Expression> getWhereExpression() const { return whereExpression; }
inline expression_vector getPredicatesSplitOnAnd() const {
return hasWhereExpression() ? whereExpression->splitOnAND() : expression_vector{};
}

expression_vector getChildren() const override;

Expand Down
5 changes: 3 additions & 2 deletions src/include/binder/query/reading_clause/bound_match_clause.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ class BoundMatchClause : public BoundReadingClause {
inline void setWhereExpression(std::shared_ptr<Expression> expression) {
whereExpression = std::move(expression);
}

inline bool hasWhereExpression() const { return whereExpression != nullptr; }

inline std::shared_ptr<Expression> getWhereExpression() const { return whereExpression; }
inline expression_vector getPredicatesSplitOnAnd() const {
return hasWhereExpression() ? whereExpression->splitOnAND() : expression_vector{};
}

inline bool getIsOptional() const { return isOptional; }

Expand Down
1 change: 0 additions & 1 deletion src/parser/transformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ std::unique_ptr<PatternElement> Transformer::transformPatternElement(

std::unique_ptr<NodePattern> Transformer::transformNodePattern(
CypherParser::OC_NodePatternContext& ctx) {
// TODO:come back
auto variable = ctx.oC_Variable() ? transformVariable(*ctx.oC_Variable()) : std::string();
auto nodeLabels = ctx.oC_NodeLabels() ? transformNodeLabels(*ctx.oC_NodeLabels()) :
std::vector<std::string>{};
Expand Down
8 changes: 2 additions & 6 deletions src/planner/query_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ void QueryPlanner::planMatchClause(
BoundReadingClause* boundReadingClause, std::vector<std::unique_ptr<LogicalPlan>>& plans) {
auto boundMatchClause = (BoundMatchClause*)boundReadingClause;
auto queryGraphCollection = boundMatchClause->getQueryGraphCollection();
auto predicates = boundMatchClause->hasWhereExpression() ?
boundMatchClause->getWhereExpression()->splitOnAND() :
expression_vector{};
auto predicates = boundMatchClause->getPredicatesSplitOnAnd();
// TODO(Xiyang): when we plan a set of LogicalPlans with a (OPTIONAL)MATCH we shouldn't only
// take the best plan from (OPTIONAL)MATCH instead we should take all plans and do cartesian
// product with the set of LogicalPlans.
Expand Down Expand Up @@ -233,9 +231,7 @@ void QueryPlanner::planExistsSubquery(
auto joinNodeIDs = getJoinNodeIDs(correlatedExpressions);
// Unnest as mark join. See planOptionalMatch for unnesting logic.
auto prevContext = joinOrderEnumerator.enterSubquery(joinNodeIDs);
auto predicates = subquery->hasWhereExpression() ?
subquery->getWhereExpression()->splitOnAND() :
expression_vector{};
auto predicates = subquery->getPredicatesSplitOnAnd();
auto bestInnerPlan = getBestPlan(
joinOrderEnumerator.enumerate(*subquery->getQueryGraphCollection(), predicates));
joinOrderEnumerator.exitSubquery(std::move(prevContext));
Expand Down

0 comments on commit fe87e5b

Please sign in to comment.