Removing template from class Frame

This commit is contained in:
jeremy 2022-12-05 14:07:53 +01:00
parent 1d7f61dd0b
commit 6d3f9ab695
5 changed files with 15 additions and 17 deletions

View File

@ -36,8 +36,8 @@ template <typename TypedValue, typename EvaluationContext, typename DbAccessor,
typename PropertyValue, typename ConvFunctor, typename Error, typename Tag = StorageTag> typename PropertyValue, typename ConvFunctor, typename Error, typename Tag = StorageTag>
class ExpressionEvaluator : public ExpressionVisitor<TypedValue> { class ExpressionEvaluator : public ExpressionVisitor<TypedValue> {
public: public:
ExpressionEvaluator(Frame<TypedValue> *frame, const SymbolTable &symbol_table, const EvaluationContext &ctx, ExpressionEvaluator(Frame *frame, const SymbolTable &symbol_table, const EvaluationContext &ctx, DbAccessor *dba,
DbAccessor *dba, StorageView view) StorageView view)
: frame_(frame), symbol_table_(&symbol_table), ctx_(&ctx), dba_(dba), view_(view) {} : frame_(frame), symbol_table_(&symbol_table), ctx_(&ctx), dba_(dba), view_(view) {}
using ExpressionVisitor<TypedValue>::Visit; using ExpressionVisitor<TypedValue>::Visit;
@ -782,7 +782,7 @@ class ExpressionEvaluator : public ExpressionVisitor<TypedValue> {
LabelId GetLabel(LabelIx label) { return ctx_->labels[label.ix]; } LabelId GetLabel(LabelIx label) { return ctx_->labels[label.ix]; }
Frame<TypedValue> *frame_; Frame *frame_;
const SymbolTable *symbol_table_; const SymbolTable *symbol_table_;
const EvaluationContext *ctx_; const EvaluationContext *ctx_;
DbAccessor *dba_; DbAccessor *dba_;

View File

@ -20,7 +20,6 @@
namespace memgraph::expr { namespace memgraph::expr {
template <typename TypedValue>
class Frame { class Frame {
public: public:
/// Create a Frame of given size backed by a utils::NewDeleteResource() /// Create a Frame of given size backed by a utils::NewDeleteResource()
@ -42,12 +41,11 @@ class Frame {
utils::pmr::vector<TypedValue> elems_; utils::pmr::vector<TypedValue> elems_;
}; };
template <typename TypedValue> class FrameWithValidity final : public Frame {
class FrameWithValidity final : public Frame<TypedValue> {
public: public:
explicit FrameWithValidity(int64_t size) : Frame<TypedValue>(size), is_valid_(false) {} explicit FrameWithValidity(int64_t size) : Frame(size), is_valid_(false) {}
FrameWithValidity(int64_t size, utils::MemoryResource *memory) : Frame<TypedValue>(size, memory), is_valid_(false) {} FrameWithValidity(int64_t size, utils::MemoryResource *memory) : Frame(size, memory), is_valid_(false) {}
bool IsValid() const noexcept { return is_valid_; } bool IsValid() const noexcept { return is_valid_; }
void MakeValid() noexcept { is_valid_ = true; } void MakeValid() noexcept { is_valid_ = true; }

View File

@ -17,6 +17,6 @@
#include "query/v2/bindings/typed_value.hpp" #include "query/v2/bindings/typed_value.hpp"
namespace memgraph::query::v2 { namespace memgraph::query::v2 {
using Frame = memgraph::expr::Frame<TypedValue>; using Frame = memgraph::expr::Frame;
using FrameWithValidity = memgraph::expr::FrameWithValidity<TypedValue>; using FrameWithValidity = memgraph::expr::FrameWithValidity;
} // namespace memgraph::query::v2 } // namespace memgraph::query::v2

View File

@ -148,7 +148,7 @@ Callback HandleAuthQuery(AuthQuery *auth_query, AuthQueryHandler *auth, const Pa
// Empty frame for evaluation of password expression. This is OK since // Empty frame for evaluation of password expression. This is OK since
// password should be either null or string literal and it's evaluation // password should be either null or string literal and it's evaluation
// should not depend on frame. // should not depend on frame.
expr::Frame<TypedValue> frame(0); expr::Frame frame(0);
SymbolTable symbol_table; SymbolTable symbol_table;
EvaluationContext evaluation_context; EvaluationContext evaluation_context;
// TODO: MemoryResource for EvaluationContext, it should probably be passed as // TODO: MemoryResource for EvaluationContext, it should probably be passed as
@ -315,7 +315,7 @@ Callback HandleAuthQuery(AuthQuery *auth_query, AuthQueryHandler *auth, const Pa
Callback HandleReplicationQuery(ReplicationQuery *repl_query, const Parameters &parameters, Callback HandleReplicationQuery(ReplicationQuery *repl_query, const Parameters &parameters,
InterpreterContext *interpreter_context, RequestRouterInterface *request_router, InterpreterContext *interpreter_context, RequestRouterInterface *request_router,
std::vector<Notification> *notifications) { std::vector<Notification> *notifications) {
expr::Frame<TypedValue> frame(0); expr::Frame frame(0);
SymbolTable symbol_table; SymbolTable symbol_table;
EvaluationContext evaluation_context; EvaluationContext evaluation_context;
// TODO: MemoryResource for EvaluationContext, it should probably be passed as // TODO: MemoryResource for EvaluationContext, it should probably be passed as
@ -450,7 +450,7 @@ Callback HandleReplicationQuery(ReplicationQuery *repl_query, const Parameters &
Callback HandleSettingQuery(SettingQuery *setting_query, const Parameters &parameters, Callback HandleSettingQuery(SettingQuery *setting_query, const Parameters &parameters,
RequestRouterInterface *request_router) { RequestRouterInterface *request_router) {
expr::Frame<TypedValue> frame(0); expr::Frame frame(0);
SymbolTable symbol_table; SymbolTable symbol_table;
EvaluationContext evaluation_context; EvaluationContext evaluation_context;
// TODO: MemoryResource for EvaluationContext, it should probably be passed as // TODO: MemoryResource for EvaluationContext, it should probably be passed as
@ -663,7 +663,7 @@ struct PullPlan {
private: private:
std::shared_ptr<CachedPlan> plan_ = nullptr; std::shared_ptr<CachedPlan> plan_ = nullptr;
plan::UniqueCursorPtr cursor_ = nullptr; plan::UniqueCursorPtr cursor_ = nullptr;
expr::FrameWithValidity<TypedValue> frame_; expr::FrameWithValidity frame_;
MultiFrame multi_frame_; MultiFrame multi_frame_;
ExecutionContext ctx_; ExecutionContext ctx_;
std::optional<size_t> memory_limit_; std::optional<size_t> memory_limit_;
@ -998,7 +998,7 @@ PreparedQuery PrepareCypherQuery(ParsedQuery parsed_query, std::map<std::string,
// TriggerContextCollector *trigger_context_collector = nullptr) { // TriggerContextCollector *trigger_context_collector = nullptr) {
auto *cypher_query = utils::Downcast<CypherQuery>(parsed_query.query); auto *cypher_query = utils::Downcast<CypherQuery>(parsed_query.query);
expr::Frame<TypedValue> frame(0); expr::Frame frame(0);
SymbolTable symbol_table; SymbolTable symbol_table;
EvaluationContext evaluation_context; EvaluationContext evaluation_context;
evaluation_context.timestamp = QueryTimestamp(); evaluation_context.timestamp = QueryTimestamp();
@ -1140,7 +1140,7 @@ PreparedQuery PrepareProfileQuery(ParsedQuery parsed_query, bool in_explicit_tra
auto *cypher_query = utils::Downcast<CypherQuery>(parsed_inner_query.query); auto *cypher_query = utils::Downcast<CypherQuery>(parsed_inner_query.query);
MG_ASSERT(cypher_query, "Cypher grammar should not allow other queries in PROFILE"); MG_ASSERT(cypher_query, "Cypher grammar should not allow other queries in PROFILE");
expr::Frame<TypedValue> frame(0); expr::Frame frame(0);
SymbolTable symbol_table; SymbolTable symbol_table;
EvaluationContext evaluation_context; EvaluationContext evaluation_context;
evaluation_context.timestamp = QueryTimestamp(); evaluation_context.timestamp = QueryTimestamp();

View File

@ -17,5 +17,5 @@
#include "storage/v3/bindings/typed_value.hpp" #include "storage/v3/bindings/typed_value.hpp"
namespace memgraph::storage::v3 { namespace memgraph::storage::v3 {
using Frame = memgraph::expr::Frame<TypedValue>; using Frame = memgraph::expr::Frame;
} // namespace memgraph::storage::v3 } // namespace memgraph::storage::v3