From bfe4f273ec2770210181d28858149aaf5c5a8c2c Mon Sep 17 00:00:00 2001 From: Shylock Hg <33566796+Shylock-Hg@users.noreply.github.com> Date: Wed, 20 Apr 2022 17:59:31 +0800 Subject: [PATCH 1/2] Expression is stateful to store the result of evaluation, so we can't share it inter threads. --- src/storage/query/ScanEdgeProcessor.cpp | 10 ++++++++-- src/storage/query/ScanVertexProcessor.cpp | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/storage/query/ScanEdgeProcessor.cpp b/src/storage/query/ScanEdgeProcessor.cpp index ae328d406b5..d760d0ccc28 100644 --- a/src/storage/query/ScanEdgeProcessor.cpp +++ b/src/storage/query/ScanEdgeProcessor.cpp @@ -101,8 +101,14 @@ StoragePlan ScanEdgeProcessor::buildPlan( edges.emplace_back( std::make_unique(context, &edgeContext_, ec.first, &ec.second)); } - auto output = std::make_unique( - context, std::move(edges), enableReadFollower_, limit_, cursors, result, expCtx, filter_); + auto output = std::make_unique(context, + std::move(edges), + enableReadFollower_, + limit_, + cursors, + result, + expCtx, + filter_->clone()); plan.addNode(std::move(output)); return plan; diff --git a/src/storage/query/ScanVertexProcessor.cpp b/src/storage/query/ScanVertexProcessor.cpp index 6dafcda714d..b7788fb96b4 100644 --- a/src/storage/query/ScanVertexProcessor.cpp +++ b/src/storage/query/ScanVertexProcessor.cpp @@ -104,8 +104,14 @@ StoragePlan ScanVertexProcessor::buildPlan( for (const auto& tc : tagContext_.propContexts_) { tags.emplace_back(std::make_unique(context, &tagContext_, tc.first, &tc.second)); } - auto output = std::make_unique( - context, std::move(tags), enableReadFollower_, limit_, cursors, result, expCtx, filter_); + auto output = std::make_unique(context, + std::move(tags), + enableReadFollower_, + limit_, + cursors, + result, + expCtx, + filter_->clone()); plan.addNode(std::move(output)); return plan; From 6c4187f13b37c03a9d914e9e9132cf51660b8f49 Mon Sep 17 00:00:00 2001 From: Shylock Hg <33566796+Shylock-Hg@users.noreply.github.com> Date: Wed, 20 Apr 2022 18:42:21 +0800 Subject: [PATCH 2/2] Fix defef nullptr. --- src/storage/query/ScanEdgeProcessor.cpp | 2 +- src/storage/query/ScanVertexProcessor.cpp | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/storage/query/ScanEdgeProcessor.cpp b/src/storage/query/ScanEdgeProcessor.cpp index d760d0ccc28..1c63165595d 100644 --- a/src/storage/query/ScanEdgeProcessor.cpp +++ b/src/storage/query/ScanEdgeProcessor.cpp @@ -108,7 +108,7 @@ StoragePlan ScanEdgeProcessor::buildPlan( cursors, result, expCtx, - filter_->clone()); + filter_ == nullptr ? nullptr : filter_->clone()); plan.addNode(std::move(output)); return plan; diff --git a/src/storage/query/ScanVertexProcessor.cpp b/src/storage/query/ScanVertexProcessor.cpp index b7788fb96b4..7806daebfdd 100644 --- a/src/storage/query/ScanVertexProcessor.cpp +++ b/src/storage/query/ScanVertexProcessor.cpp @@ -104,14 +104,15 @@ StoragePlan ScanVertexProcessor::buildPlan( for (const auto& tc : tagContext_.propContexts_) { tags.emplace_back(std::make_unique(context, &tagContext_, tc.first, &tc.second)); } - auto output = std::make_unique(context, - std::move(tags), - enableReadFollower_, - limit_, - cursors, - result, - expCtx, - filter_->clone()); + auto output = + std::make_unique(context, + std::move(tags), + enableReadFollower_, + limit_, + cursors, + result, + expCtx, + filter_ == nullptr ? nullptr : filter_->clone()); plan.addNode(std::move(output)); return plan;