Remove outcommented code, conform clang-tidy

This commit is contained in:
gvolfing 2023-01-12 15:45:14 +01:00
parent 41bb988fe9
commit afde0c6926
6 changed files with 7 additions and 1702 deletions

View File

@ -512,7 +512,7 @@ class DistributedScanAllByPrimaryKeyCursor : public Cursor {
std::vector<msgs::Value> pk; std::vector<msgs::Value> pk;
MG_ASSERT(primary_key_); MG_ASSERT(primary_key_);
for (auto primary_key : *primary_key_) { for (auto *primary_key : *primary_key_) {
pk.push_back(TypedValueToValue(primary_key->Accept(evaluator))); pk.push_back(TypedValueToValue(primary_key->Accept(evaluator)));
} }
@ -589,7 +589,7 @@ class DistributedScanAllByPrimaryKeyCursor : public Cursor {
SCOPED_PROFILE_OP(op_name_); SCOPED_PROFILE_OP(op_name_);
if (!own_multi_frames_.has_value()) { if (!own_multi_frames_.has_value()) {
// NOLINTNEXTLINE(bugprone-narrowing-conversions) // NOLINTNEXTLINE(cppcoreguidelines-narrowing-conversions)
own_multi_frames_.emplace(MultiFrame(input_multi_frame.GetFirstFrame().elems().size(), own_multi_frames_.emplace(MultiFrame(input_multi_frame.GetFirstFrame().elems().size(),
kNumberOfFramesInMultiframe, input_multi_frame.GetMemoryResource())); kNumberOfFramesInMultiframe, input_multi_frame.GetMemoryResource()));
PrepareNextFrames(context); PrepareNextFrames(context);
@ -755,10 +755,8 @@ UniqueCursorPtr ScanAllByPrimaryKey::MakeCursor(utils::MemoryResource *mem) cons
EventCounter::IncrementCounter(EventCounter::ScanAllByPrimaryKeyOperator); EventCounter::IncrementCounter(EventCounter::ScanAllByPrimaryKeyOperator);
return MakeUniqueCursorPtr<DistributedScanAllByPrimaryKeyCursor>( return MakeUniqueCursorPtr<DistributedScanAllByPrimaryKeyCursor>(
mem, output_symbol_, input_->MakeCursor(mem), "ScanAll", label_, std::nullopt /*property_expression_pair*/, mem, output_symbol_, input_->MakeCursor(mem), "ScanAllByPrimaryKey", label_,
std::nullopt /*filter_expressions*/, primary_key_); std::nullopt /*property_expression_pair*/, std::nullopt /*filter_expressions*/, primary_key_);
throw QueryRuntimeException("ScanAllByPrimaryKey cursur is yet to be implemented.");
} }
Expand::Expand(const std::shared_ptr<LogicalOperator> &input, Symbol input_symbol, Symbol node_symbol, Expand::Expand(const std::shared_ptr<LogicalOperator> &input, Symbol input_symbol, Symbol node_symbol,

View File

@ -868,7 +868,6 @@ given label and property.
(:serialize (:slk)) (:serialize (:slk))
(:clone)) (:clone))
(lcp:define-struct expand-common () (lcp:define-struct expand-common ()
( (
;; info on what's getting expanded ;; info on what's getting expanded

View File

@ -1,4 +1,4 @@
// Copyright 2022 Memgraph Ltd. // Copyright 2023 Memgraph Ltd.
// //
// Use of this software is governed by the Business Source License // Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source // included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
@ -46,8 +46,6 @@
#include "storage/v2/id_types.hpp" #include "storage/v2/id_types.hpp"
#include "utils/string.hpp" #include "utils/string.hpp"
#include "query/v2/frontend/ast/ast.hpp"
namespace memgraph::query { namespace memgraph::query {
namespace test_common { namespace test_common {
@ -83,15 +81,12 @@ std::string ToString(NamedExpression *expr) {
struct OrderBy { struct OrderBy {
std::vector<SortItem> expressions; std::vector<SortItem> expressions;
}; };
struct Skip { struct Skip {
Expression *expression = nullptr; Expression *expression = nullptr;
}; };
struct Limit { struct Limit {
Expression *expression = nullptr; Expression *expression = nullptr;
}; };
struct OnMatch { struct OnMatch {
std::vector<Clause *> set; std::vector<Clause *> set;
}; };

View File

@ -1,4 +1,4 @@
// Copyright 2022 Memgraph Ltd. // Copyright 2023 Memgraph Ltd.
// //
// Use of this software is governed by the Business Source License // Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source // included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
@ -344,10 +344,6 @@ class ExpectScanAllByPrimaryKey : public OpChecker<v2::plan::ScanAllByPrimaryKey
void ExpectOp(v2::plan::ScanAllByPrimaryKey &scan_all, const SymbolTable &) override { void ExpectOp(v2::plan::ScanAllByPrimaryKey &scan_all, const SymbolTable &) override {
EXPECT_EQ(scan_all.label_, label_); EXPECT_EQ(scan_all.label_, label_);
// EXPECT_EQ(scan_all.property_, property_);
// TODO(gvolfing) maybe assert the size of the 2 vectors.
// TODO(gvolfing) maybe use some std alg if Expression lets us.
bool primary_property_match = true; bool primary_property_match = true;
for (const auto &expected_prop : properties_) { for (const auto &expected_prop : properties_) {

View File

@ -1,4 +1,4 @@
// Copyright 2022 Memgraph Ltd. // Copyright 2023 Memgraph Ltd.
// //
// Use of this software is governed by the Business Source License // Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source // included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
@ -133,14 +133,11 @@ class OpChecker : public BaseOpChecker {
virtual void ExpectOp(TOp &, const SymbolTable &) {} virtual void ExpectOp(TOp &, const SymbolTable &) {}
}; };
// using ExpectScanAllByPrimaryKey = OpChecker<ScanAllByPrimaryKey>;
using ExpectCreateNode = OpChecker<CreateNode>; using ExpectCreateNode = OpChecker<CreateNode>;
using ExpectCreateExpand = OpChecker<CreateExpand>; using ExpectCreateExpand = OpChecker<CreateExpand>;
using ExpectDelete = OpChecker<Delete>; using ExpectDelete = OpChecker<Delete>;
using ExpectScanAll = OpChecker<ScanAll>; using ExpectScanAll = OpChecker<ScanAll>;
using ExpectScanAllByLabel = OpChecker<ScanAllByLabel>; using ExpectScanAllByLabel = OpChecker<ScanAllByLabel>;
// using ExpectScanAllById = OpChecker<ScanAllById>;
using ExpectExpand = OpChecker<Expand>; using ExpectExpand = OpChecker<Expand>;
using ExpectFilter = OpChecker<Filter>; using ExpectFilter = OpChecker<Filter>;
using ExpectConstructNamedPath = OpChecker<ConstructNamedPath>; using ExpectConstructNamedPath = OpChecker<ConstructNamedPath>;
@ -157,120 +154,6 @@ using ExpectOrderBy = OpChecker<OrderBy>;
using ExpectUnwind = OpChecker<Unwind>; using ExpectUnwind = OpChecker<Unwind>;
using ExpectDistinct = OpChecker<Distinct>; using ExpectDistinct = OpChecker<Distinct>;
// class ExpectForeach : public OpChecker<Foreach> {
// public:
// ExpectForeach(const std::list<BaseOpChecker *> &input, const std::list<BaseOpChecker *> &updates)
// : input_(input), updates_(updates) {}
// void ExpectOp(Foreach &foreach, const SymbolTable &symbol_table) override {
// PlanChecker check_input(input_, symbol_table);
// foreach
// .input_->Accept(check_input);
// PlanChecker check_updates(updates_, symbol_table);
// foreach
// .update_clauses_->Accept(check_updates);
// }
// private:
// std::list<BaseOpChecker *> input_;
// std::list<BaseOpChecker *> updates_;
// };
// class ExpectExpandVariable : public OpChecker<ExpandVariable> {
// public:
// void ExpectOp(ExpandVariable &op, const SymbolTable &) override {
// EXPECT_EQ(op.type_, memgraph::query::EdgeAtom::Type::DEPTH_FIRST);
// }
// };
// class ExpectExpandBfs : public OpChecker<ExpandVariable> {
// public:
// void ExpectOp(ExpandVariable &op, const SymbolTable &) override {
// EXPECT_EQ(op.type_, memgraph::query::EdgeAtom::Type::BREADTH_FIRST);
// }
// };
// class ExpectAccumulate : public OpChecker<Accumulate> {
// public:
// explicit ExpectAccumulate(const std::unordered_set<Symbol> &symbols) : symbols_(symbols) {}
// void ExpectOp(Accumulate &op, const SymbolTable &) override {
// std::unordered_set<Symbol> got_symbols(op.symbols_.begin(), op.symbols_.end());
// EXPECT_EQ(symbols_, got_symbols);
// }
// private:
// const std::unordered_set<Symbol> symbols_;
// };
// class ExpectAggregate : public OpChecker<Aggregate> {
// public:
// ExpectAggregate(const std::vector<memgraph::query::Aggregation *> &aggregations,
// const std::unordered_set<memgraph::query::Expression *> &group_by)
// : aggregations_(aggregations), group_by_(group_by) {}
// void ExpectOp(Aggregate &op, const SymbolTable &symbol_table) override {
// auto aggr_it = aggregations_.begin();
// for (const auto &aggr_elem : op.aggregations_) {
// ASSERT_NE(aggr_it, aggregations_.end());
// auto aggr = *aggr_it++;
// // TODO: Proper expression equality
// EXPECT_EQ(typeid(aggr_elem.value).hash_code(), typeid(aggr->expression1_).hash_code());
// EXPECT_EQ(typeid(aggr_elem.key).hash_code(), typeid(aggr->expression2_).hash_code());
// EXPECT_EQ(aggr_elem.op, aggr->op_);
// EXPECT_EQ(aggr_elem.output_sym, symbol_table.at(*aggr));
// }
// EXPECT_EQ(aggr_it, aggregations_.end());
// // TODO: Proper group by expression equality
// std::unordered_set<size_t> got_group_by;
// for (auto *expr : op.group_by_) got_group_by.insert(typeid(*expr).hash_code());
// std::unordered_set<size_t> expected_group_by;
// for (auto *expr : group_by_) expected_group_by.insert(typeid(*expr).hash_code());
// EXPECT_EQ(got_group_by, expected_group_by);
// }
// private:
// std::vector<memgraph::query::Aggregation *> aggregations_;
// std::unordered_set<memgraph::query::Expression *> group_by_;
// };
// class ExpectMerge : public OpChecker<Merge> {
// public:
// ExpectMerge(const std::list<BaseOpChecker *> &on_match, const std::list<BaseOpChecker *> &on_create)
// : on_match_(on_match), on_create_(on_create) {}
// void ExpectOp(Merge &merge, const SymbolTable &symbol_table) override {
// PlanChecker check_match(on_match_, symbol_table);
// merge.merge_match_->Accept(check_match);
// PlanChecker check_create(on_create_, symbol_table);
// merge.merge_create_->Accept(check_create);
// }
// private:
// const std::list<BaseOpChecker *> &on_match_;
// const std::list<BaseOpChecker *> &on_create_;
// };
// class ExpectOptional : public OpChecker<Optional> {
// public:
// explicit ExpectOptional(const std::list<BaseOpChecker *> &optional) : optional_(optional) {}
// ExpectOptional(const std::vector<Symbol> &optional_symbols, const std::list<BaseOpChecker *> &optional)
// : optional_symbols_(optional_symbols), optional_(optional) {}
// void ExpectOp(Optional &optional, const SymbolTable &symbol_table) override {
// if (!optional_symbols_.empty()) {
// EXPECT_THAT(optional.optional_symbols_, testing::UnorderedElementsAreArray(optional_symbols_));
// }
// PlanChecker check_optional(optional_, symbol_table);
// optional.optional_->Accept(check_optional);
// }
// private:
// std::vector<Symbol> optional_symbols_;
// const std::list<BaseOpChecker *> &optional_;
// };
class ExpectScanAllByLabelPropertyValue : public OpChecker<ScanAllByLabelPropertyValue> { class ExpectScanAllByLabelPropertyValue : public OpChecker<ScanAllByLabelPropertyValue> {
public: public:
ExpectScanAllByLabelPropertyValue(memgraph::storage::v3::LabelId label, ExpectScanAllByLabelPropertyValue(memgraph::storage::v3::LabelId label,
@ -291,53 +174,6 @@ class ExpectScanAllByLabelPropertyValue : public OpChecker<ScanAllByLabelPropert
memgraph::query::v2::Expression *expression_; memgraph::query::v2::Expression *expression_;
}; };
// class ExpectScanAllByLabelPropertyRange : public OpChecker<ScanAllByLabelPropertyRange> {
// public:
// ExpectScanAllByLabelPropertyRange(memgraph::storage::LabelId label, memgraph::storage::PropertyId property,
// std::optional<ScanAllByLabelPropertyRange::Bound> lower_bound,
// std::optional<ScanAllByLabelPropertyRange::Bound> upper_bound)
// : label_(label), property_(property), lower_bound_(lower_bound), upper_bound_(upper_bound) {}
// void ExpectOp(ScanAllByLabelPropertyRange &scan_all, const SymbolTable &) override {
// EXPECT_EQ(scan_all.label_, label_);
// EXPECT_EQ(scan_all.property_, property_);
// if (lower_bound_) {
// ASSERT_TRUE(scan_all.lower_bound_);
// // TODO: Proper expression equality
// EXPECT_EQ(typeid(scan_all.lower_bound_->value()).hash_code(), typeid(lower_bound_->value()).hash_code());
// EXPECT_EQ(scan_all.lower_bound_->type(), lower_bound_->type());
// }
// if (upper_bound_) {
// ASSERT_TRUE(scan_all.upper_bound_);
// // TODO: Proper expression equality
// EXPECT_EQ(typeid(scan_all.upper_bound_->value()).hash_code(), typeid(upper_bound_->value()).hash_code());
// EXPECT_EQ(scan_all.upper_bound_->type(), upper_bound_->type());
// }
// }
// private:
// memgraph::storage::LabelId label_;
// memgraph::storage::PropertyId property_;
// std::optional<ScanAllByLabelPropertyRange::Bound> lower_bound_;
// std::optional<ScanAllByLabelPropertyRange::Bound> upper_bound_;
// };
// class ExpectScanAllByLabelProperty : public OpChecker<ScanAllByLabelProperty> {
// public:
// ExpectScanAllByLabelProperty(memgraph::storage::LabelId label,
// const std::pair<std::string, memgraph::storage::PropertyId> &prop_pair)
// : label_(label), property_(prop_pair.second) {}
// void ExpectOp(ScanAllByLabelProperty &scan_all, const SymbolTable &) override {
// EXPECT_EQ(scan_all.label_, label_);
// EXPECT_EQ(scan_all.property_, property_);
// }
// private:
// memgraph::storage::LabelId label_;
// memgraph::storage::PropertyId property_;
// };
class ExpectScanAllByPrimaryKey : public OpChecker<v2::plan::ScanAllByPrimaryKey> { class ExpectScanAllByPrimaryKey : public OpChecker<v2::plan::ScanAllByPrimaryKey> {
public: public:
ExpectScanAllByPrimaryKey(memgraph::storage::v3::LabelId label, const std::vector<Expression *> &properties) ExpectScanAllByPrimaryKey(memgraph::storage::v3::LabelId label, const std::vector<Expression *> &properties)

File diff suppressed because it is too large Load Diff