Address PR comments

This commit is contained in:
gvolfing 2023-01-24 16:59:38 +01:00
parent 27ff18733c
commit 36fccc32c2
6 changed files with 15 additions and 20 deletions

View File

@ -573,15 +573,13 @@ class DistributedScanByPrimaryKeyCursor : public Cursor {
throw HintedAbortError(); throw HintedAbortError();
} }
if (!input_cursor_->Pull(frame, context)) { while (input_cursor_->Pull(frame, context)) {
return false; auto &request_router = *context.request_router;
} auto vertex = MakeRequestSingleFrame(frame, request_router, context);
if (vertex) {
auto &request_router = *context.request_router; frame[output_symbol_] = TypedValue(std::move(*vertex));
auto vertex = MakeRequestSingleFrame(frame, request_router, context); return true;
if (vertex) { }
frame[output_symbol_] = TypedValue(std::move(*vertex));
return true;
} }
return false; return false;
} }
@ -601,10 +599,6 @@ class DistributedScanByPrimaryKeyCursor : public Cursor {
storage::v3::LabelId label_; storage::v3::LabelId label_;
std::optional<std::vector<Expression *>> filter_expressions_; std::optional<std::vector<Expression *>> filter_expressions_;
std::vector<Expression *> primary_key_; std::vector<Expression *> primary_key_;
std::optional<MultiFrame> own_multi_frames_;
std::optional<ValidFramesConsumer> valid_frames_consumer_;
ValidFramesConsumer::Iterator valid_frames_it_;
std::queue<FrameWithValidity> frames_buffer_;
}; };
ScanAll::ScanAll(const std::shared_ptr<LogicalOperator> &input, Symbol output_symbol, storage::v3::View view) ScanAll::ScanAll(const std::shared_ptr<LogicalOperator> &input, Symbol output_symbol, storage::v3::View view)

View File

@ -61,7 +61,7 @@ class VertexCountCache {
bool LabelPropertyIndexExists(storage::v3::LabelId /*label*/, storage::v3::PropertyId /*property*/) { return false; } bool LabelPropertyIndexExists(storage::v3::LabelId /*label*/, storage::v3::PropertyId /*property*/) { return false; }
std::vector<memgraph::storage::v3::SchemaProperty> GetSchemaForLabel(storage::v3::LabelId label) { const std::vector<memgraph::storage::v3::SchemaProperty> &GetSchemaForLabel(storage::v3::LabelId label) {
return request_router_->GetSchemaForLabel(label); return request_router_->GetSchemaForLabel(label);
} }

View File

@ -114,7 +114,7 @@ class RequestRouterInterface {
virtual std::optional<storage::v3::LabelId> MaybeNameToLabel(const std::string &name) const = 0; virtual std::optional<storage::v3::LabelId> MaybeNameToLabel(const std::string &name) const = 0;
virtual bool IsPrimaryLabel(storage::v3::LabelId label) const = 0; virtual bool IsPrimaryLabel(storage::v3::LabelId label) const = 0;
virtual bool IsPrimaryKey(storage::v3::LabelId primary_label, storage::v3::PropertyId property) const = 0; virtual bool IsPrimaryKey(storage::v3::LabelId primary_label, storage::v3::PropertyId property) const = 0;
virtual std::vector<coordinator::SchemaProperty> GetSchemaForLabel(storage::v3::LabelId label) const = 0; virtual const std::vector<coordinator::SchemaProperty> &GetSchemaForLabel(storage::v3::LabelId label) const = 0;
}; };
// TODO(kostasrim)rename this class template // TODO(kostasrim)rename this class template
@ -233,7 +233,7 @@ class RequestRouter : public RequestRouterInterface {
}) != schema_it->second.end(); }) != schema_it->second.end();
} }
std::vector<coordinator::SchemaProperty> GetSchemaForLabel(storage::v3::LabelId label) const override { const std::vector<coordinator::SchemaProperty> &GetSchemaForLabel(storage::v3::LabelId label) const override {
return shards_map_.schemas.at(label); return shards_map_.schemas.at(label);
} }

View File

@ -42,7 +42,7 @@ class MockedRequestRouter : public RequestRouterInterface {
MOCK_METHOD(std::optional<storage::v3::LabelId>, MaybeNameToLabel, (const std::string &), (const)); MOCK_METHOD(std::optional<storage::v3::LabelId>, MaybeNameToLabel, (const std::string &), (const));
MOCK_METHOD(bool, IsPrimaryLabel, (storage::v3::LabelId), (const)); MOCK_METHOD(bool, IsPrimaryLabel, (storage::v3::LabelId), (const));
MOCK_METHOD(bool, IsPrimaryKey, (storage::v3::LabelId, storage::v3::PropertyId), (const)); MOCK_METHOD(bool, IsPrimaryKey, (storage::v3::LabelId, storage::v3::PropertyId), (const));
MOCK_METHOD(std::vector<coordinator::SchemaProperty>, GetSchemaForLabel, (storage::v3::LabelId), (const)); MOCK_METHOD(const std::vector<coordinator::SchemaProperty> &, GetSchemaForLabel, (storage::v3::LabelId), (const));
}; };
class MockedLogicalOperator : public plan::LogicalOperator { class MockedLogicalOperator : public plan::LogicalOperator {

View File

@ -381,7 +381,7 @@ class FakeDistributedDbAccessor {
return find_in_secondary_properties->second; return find_in_secondary_properties->second;
} }
MG_ASSERT(false, "The property does not exist as a primary or a secondary property."); LOG_FATAL("The property does not exist as a primary or a secondary property.");
return memgraph::storage::v3::PropertyId::FromUint(0); return memgraph::storage::v3::PropertyId::FromUint(0);
} }

View File

@ -125,8 +125,9 @@ class MockedRequestRouter : public RequestRouterInterface {
bool IsPrimaryKey(LabelId primary_label, PropertyId property) const override { return true; } bool IsPrimaryKey(LabelId primary_label, PropertyId property) const override { return true; }
std::vector<coordinator::SchemaProperty> GetSchemaForLabel(storage::v3::LabelId /*label*/) const override { const std::vector<coordinator::SchemaProperty> &GetSchemaForLabel(storage::v3::LabelId /*label*/) const override {
return std::vector<coordinator::SchemaProperty>{}; static std::vector<coordinator::SchemaProperty> schema;
return schema;
}; };
private: private: