From 796131cbc1073c78cde4acfeb7b3920a68ddfa2e Mon Sep 17 00:00:00 2001 From: jimingquan Date: Sat, 23 Jul 2022 22:51:03 +0800 Subject: [PATCH] fix error --- src/graph/executor/query/UnwindExecutor.cpp | 2 +- src/graph/planner/plan/Query.h | 9 +++++++++ src/graph/validator/UnwindValidator.cpp | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/graph/executor/query/UnwindExecutor.cpp b/src/graph/executor/query/UnwindExecutor.cpp index de1d774e0a7..1e42993fa3b 100644 --- a/src/graph/executor/query/UnwindExecutor.cpp +++ b/src/graph/executor/query/UnwindExecutor.cpp @@ -26,7 +26,7 @@ folly::Future UnwindExecutor::execute() { std::vector vals = extractList(list); for (auto &v : vals) { Row row; - if (!emptyInput) { + if (!unwind->fromPipe() && !emptyInput) { row = *(iter->row()); } row.values.emplace_back(std::move(v)); diff --git a/src/graph/planner/plan/Query.h b/src/graph/planner/plan/Query.h index 8144e27ef5d..0f74d65dc68 100644 --- a/src/graph/planner/plan/Query.h +++ b/src/graph/planner/plan/Query.h @@ -841,6 +841,14 @@ class Unwind final : public SingleInputNode { return alias_; } + bool fromPipe() const { + return fromPipe_; + } + + void setFromPipe() { + fromPipe_ = true; + } + PlanNode* clone() const override; std::unique_ptr explain() const override; @@ -854,6 +862,7 @@ class Unwind final : public SingleInputNode { private: Expression* unwindExpr_{nullptr}; std::string alias_; + bool fromPipe_{false}; }; // Sort the given record set. diff --git a/src/graph/validator/UnwindValidator.cpp b/src/graph/validator/UnwindValidator.cpp index cd0d44d219c..7075b5bcebf 100644 --- a/src/graph/validator/UnwindValidator.cpp +++ b/src/graph/validator/UnwindValidator.cpp @@ -34,6 +34,7 @@ Status UnwindValidator::validateImpl() { Status UnwindValidator::toPlan() { auto *unwind = Unwind::make(qctx_, nullptr, unwindExpr_, alias_); unwind->setColNames({alias_}); + unwind->setFromPipe(); root_ = tail_ = unwind; return Status::OK(); }