diff --git a/src/query/v2/interpreter.cpp b/src/query/v2/interpreter.cpp index aa220d764..6f07b598e 100644 --- a/src/query/v2/interpreter.cpp +++ b/src/query/v2/interpreter.cpp @@ -688,7 +688,7 @@ PullPlan::PullPlan(const std::shared_ptr plan, const Parameters &par : plan_(plan), cursor_(plan->plan().MakeCursor(execution_memory)), frame_(plan->symbol_table().max_position(), execution_memory), - multi_frame_(plan->symbol_table().max_position(), kNumberOfFramesInMultiframe, execution_memory), + multi_frame_(plan->symbol_table().max_position(), FLAGS_default_multi_frame_size, execution_memory), memory_limit_(memory_limit) { ctx_.db_accessor = dba; ctx_.symbol_table = plan->symbol_table(); diff --git a/src/query/v2/multiframe.cpp b/src/query/v2/multiframe.cpp index 477ef6c0c..264990bb7 100644 --- a/src/query/v2/multiframe.cpp +++ b/src/query/v2/multiframe.cpp @@ -17,6 +17,8 @@ #include "query/v2/bindings/frame.hpp" #include "utils/pmr/vector.hpp" +DEFINE_uint64(default_multi_frame_size, 100, "Default size of MultiFrame"); + namespace memgraph::query::v2 { static_assert(std::forward_iterator); diff --git a/src/query/v2/multiframe.hpp b/src/query/v2/multiframe.hpp index 6958ffbe8..396092c2b 100644 --- a/src/query/v2/multiframe.hpp +++ b/src/query/v2/multiframe.hpp @@ -13,10 +13,13 @@ #include +#include + #include "query/v2/bindings/frame.hpp" +DECLARE_uint64(default_multi_frame_size); + namespace memgraph::query::v2 { -constexpr uint64_t kNumberOfFramesInMultiframe = 1000; // TODO have it configurable class ValidFramesConsumer; class ValidFramesModifier; diff --git a/src/query/v2/plan/operator.cpp b/src/query/v2/plan/operator.cpp index 1841668bb..993d24282 100644 --- a/src/query/v2/plan/operator.cpp +++ b/src/query/v2/plan/operator.cpp @@ -509,7 +509,7 @@ class DistributedScanAllAndFilterCursor : public Cursor { if (!own_multi_frame_.has_value()) { own_multi_frame_.emplace(MultiFrame(output_multi_frame.GetFirstFrame().elems().size(), - kNumberOfFramesInMultiframe, output_multi_frame.GetMemoryResource())); + FLAGS_default_multi_frame_size, output_multi_frame.GetMemoryResource())); own_frames_consumer_.emplace(own_multi_frame_->GetValidFramesConsumer()); own_frames_it_ = own_frames_consumer_->begin(); } @@ -705,7 +705,7 @@ class DistributedScanByPrimaryKeyCursor : public Cursor { void EnsureOwnMultiFrameIsGood(MultiFrame &output_multi_frame) { if (!own_multi_frame_.has_value()) { own_multi_frame_.emplace(MultiFrame(output_multi_frame.GetFirstFrame().elems().size(), - kNumberOfFramesInMultiframe, output_multi_frame.GetMemoryResource())); + FLAGS_default_multi_frame_size, output_multi_frame.GetMemoryResource())); own_frames_consumer_.emplace(own_multi_frame_->GetValidFramesConsumer()); own_frames_it_ = own_frames_consumer_->begin(); } @@ -2213,7 +2213,7 @@ class UnwindCursor : public Cursor { if (!own_multi_frame_.has_value()) { own_multi_frame_.emplace(MultiFrame(output_multi_frame.GetFirstFrame().elems().size(), - kNumberOfFramesInMultiframe, output_multi_frame.GetMemoryResource())); + FLAGS_default_multi_frame_size, output_multi_frame.GetMemoryResource())); own_frames_consumer_.emplace(own_multi_frame_->GetValidFramesConsumer()); own_frames_it_ = own_frames_consumer_->begin(); } @@ -3382,7 +3382,7 @@ class DistributedExpandCursor : public Cursor { void EnsureOwnMultiFrameIsGood(MultiFrame &output_multi_frame) { if (!own_multi_frame_.has_value()) { own_multi_frame_.emplace(MultiFrame(output_multi_frame.GetFirstFrame().elems().size(), - kNumberOfFramesInMultiframe, output_multi_frame.GetMemoryResource())); + FLAGS_default_multi_frame_size, output_multi_frame.GetMemoryResource())); own_frames_consumer_.emplace(own_multi_frame_->GetValidFramesConsumer()); own_frames_it_ = own_frames_consumer_->begin(); }