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

fix ci crash #1298

Merged
merged 1 commit into from
Jul 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/planner/match/MatchPlanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,17 @@ StatusOr<SubPlan> MatchPlanner::transform(AstContext* astCtx) {
}
}

auto finalPlan = connectSegments(subplans, matchCtx->clauses);
auto finalPlan = connectSegments(astCtx, subplans, matchCtx->clauses);
NG_RETURN_IF_ERROR(finalPlan);
return std::move(finalPlan).value();
}

StatusOr<SubPlan> MatchPlanner::connectSegments(
AstContext* astCtx,
std::vector<SubPlan>& subplans,
std::vector<std::unique_ptr<CypherClauseContextBase>>& clauses) {
DCHECK(!subplans.empty());
subplans.front().tail->setInputVar(astCtx->qctx->vctx()->anonVarGen()->getVar());
if (subplans.size() == 1) {
return subplans.front();
}
Expand Down
1 change: 1 addition & 0 deletions src/planner/match/MatchPlanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class MatchPlanner final : public Planner {

private:
StatusOr<SubPlan> connectSegments(
AstContext* astCtx,
std::vector<SubPlan>& subplans,
std::vector<std::unique_ptr<CypherClauseContextBase>>& clauses);
};
Expand Down
26 changes: 4 additions & 22 deletions src/validator/YieldValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ Status YieldValidator::validateImpl() {
return Status::SemanticError("Only one variable allowed to use.");
}

if (!groupByValidator_ && exprProps_.inputProps().empty()
&& exprProps_.varProps().empty() && inputVarName_.empty()) {
// generate constant expression result into querycontext
genConstantExprValues();
}

if (!exprProps_.varProps().empty() && !userDefinedVarNameList_.empty()) {
// TODO: Support Multiple userDefinedVars
if (userDefinedVarNameList_.size() != 1) {
Expand Down Expand Up @@ -90,20 +84,6 @@ Status YieldValidator::makeOutputColumn(YieldColumn *column) {
return Status::OK();
}

void YieldValidator::genConstantExprValues() {
constantExprVar_ = vctx_->anonVarGen()->getVar();
DataSet ds;
ds.colNames = getOutColNames();
QueryExpressionContext ctx;
Row row;
for (auto &column : columns_->columns()) {
row.values.emplace_back(Expression::eval(column->expr(), ctx(nullptr)));
}
ds.emplace_back(std::move(row));
qctx_->ectx()->setResult(constantExprVar_,
ResultBuilder().value(Value(std::move(ds))).finish());
}

Status YieldValidator::makeImplicitGroupByValidator() {
auto* groupSentence = qctx()->objPool()->add(
new GroupBySentence(
Expand Down Expand Up @@ -192,8 +172,10 @@ Status YieldValidator::toPlan() {
if (!userDefinedVarName_.empty()) {
inputVar = userDefinedVarName_;
colNames = qctx_->symTable()->getVar(inputVar)->colNames;
} else if (!constantExprVar_.empty()) {
inputVar = constantExprVar_;
} else if (exprProps_.inputProps().empty()
&& exprProps_.varProps().empty() && inputVarName_.empty()) {
// generate constant expression result into querycontext
inputVar = vctx_->anonVarGen()->getVar();
} else {
std::transform(
inputs_.cbegin(), inputs_.cend(), colNames.begin(), [](auto &col) { return col.name; });
Expand Down