Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small refactoring for expression visitor impl class #5435

Merged
merged 2 commits into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/common/expression/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ nebula_add_library(
ListComprehensionExpression.cpp
ReduceExpression.cpp
MatchPathPatternExpression.cpp
ExprVisitorImpl.cpp
)

nebula_add_subdirectory(test)
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* Copyright (c) 2020 vesoft inc. All rights reserved.
/* Copyright (c) 2023 vesoft inc. All rights reserved.
*
* This source code is licensed under Apache 2.0 License.
*/

#include "graph/visitor/ExprVisitorImpl.h"
#include "common/expression/ExprVisitorImpl.h"

namespace nebula {
namespace graph {

void ExprVisitorImpl::visit(UnaryExpression *expr) {
DCHECK(ok()) << expr->toString();
Expand Down Expand Up @@ -210,5 +209,4 @@ void ExprVisitorImpl::visit(MatchPathPatternExpression *expr) {
}
}

} // namespace graph
} // namespace nebula
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
/* Copyright (c) 2020 vesoft inc. All rights reserved.
/* Copyright (c) 2023 vesoft inc. All rights reserved.
*
* This source code is licensed under Apache 2.0 License.
*/

#ifndef GRAPH_VISITOR_EXPRVISITORIMPL_H_
#define GRAPH_VISITOR_EXPRVISITORIMPL_H_
#ifndef COMMON_VISITOR_EXPRVISITORIMPL_H_
#define COMMON_VISITOR_EXPRVISITORIMPL_H_

#include "common/expression/ColumnExpression.h"
#include "common/expression/ExprVisitor.h"
#include "common/expression/PropertyExpression.h"
#include "common/expression/VertexExpression.h"

namespace nebula {
namespace graph {

class ExprVisitorImpl : public ExprVisitor {
public:
// leaf expression nodes
void visit(ConstantExpression *) override {}
void visit(LabelExpression *) override{};
void visit(UUIDExpression *) override{};
void visit(VariableExpression *) override{};
void visit(VersionedVariableExpression *) override{};
void visit(InputPropertyExpression *) override{};
void visit(VariablePropertyExpression *) override{};
void visit(DestPropertyExpression *) override{};
void visit(SourcePropertyExpression *) override{};
void visit(VertexExpression *) override{};
void visit(EdgeExpression *) override{};
void visit(ColumnExpression *) override{};
// unary expression
void visit(UnaryExpression *expr) override;
void visit(TypeCastingExpression *expr) override;
void visit(LabelAttributeExpression *expr) override;
Expand Down Expand Up @@ -48,10 +64,11 @@ class ExprVisitorImpl : public ExprVisitor {
using ExprVisitor::visit;

virtual void visitBinaryExpr(BinaryExpression *expr);
virtual bool ok() const = 0;
virtual bool ok() const {
return true;
}
};

} // namespace graph
} // namespace nebula

#endif // GRAPH_VISITOR_EXPRVISITORIMPL_H_
#endif // COMMON_VISITOR_EXPRVISITORIMPL_H_
1 change: 0 additions & 1 deletion src/graph/visitor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

nebula_add_library(
expr_visitor_obj OBJECT
ExprVisitorImpl.cpp
DeducePropsVisitor.cpp
PropertyTrackerVisitor.cpp
DeduceTypeVisitor.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/graph/visitor/DeducePropsVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#define GRAPH_VISITOR_DEDUCEPROPSVISITOR_H_

#include "common/base/Status.h"
#include "common/expression/ExprVisitorImpl.h"
#include "common/thrift/ThriftTypes.h"
#include "graph/visitor/ExprVisitorImpl.h"

namespace nebula {

Expand Down
2 changes: 1 addition & 1 deletion src/graph/visitor/EvaluableExprVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef GRAPH_VISITOR_EVALUABLEEXPRVISITOR_H_
#define GRAPH_VISITOR_EVALUABLEEXPRVISITOR_H_

#include "graph/visitor/ExprVisitorImpl.h"
#include "common/expression/ExprVisitorImpl.h"

namespace nebula {
namespace graph {
Expand Down
2 changes: 1 addition & 1 deletion src/graph/visitor/ExtractFilterExprVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <memory>

#include "graph/visitor/ExprVisitorImpl.h"
#include "common/expression/ExprVisitorImpl.h"

namespace nebula {
namespace graph {
Expand Down
2 changes: 1 addition & 1 deletion src/graph/visitor/ExtractGroupSuiteVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#ifndef GRAPH_VISITOR_EXTRACTGROUPSUITEVISITOR_H_
#define GRAPH_VISITOR_EXTRACTGROUPSUITEVISITOR_H_

#include "common/expression/ExprVisitorImpl.h"
#include "graph/context/ast/CypherAstContext.h"
#include "graph/visitor/ExprVisitorImpl.h"

namespace nebula {
namespace graph {
Expand Down
2 changes: 1 addition & 1 deletion src/graph/visitor/ExtractPropExprVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#ifndef GRAPH_VISITOR_EXTRACTPROPEXPRVISITOR_H_
#define GRAPH_VISITOR_EXTRACTPROPEXPRVISITOR_H_

#include "common/expression/ExprVisitorImpl.h"
#include "graph/context/ValidateContext.h"
#include "graph/visitor/ExprVisitorImpl.h"
#include "parser/Clauses.h"

namespace nebula {
Expand Down
2 changes: 1 addition & 1 deletion src/graph/visitor/FindVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#ifndef GRAPH_VISITOR_FINDVISITOR_H_
#define GRAPH_VISITOR_FINDVISITOR_H_

#include "common/expression/ExprVisitorImpl.h"
#include "common/expression/Expression.h"
#include "graph/visitor/ExprVisitorImpl.h"

namespace nebula {
namespace graph {
Expand Down
2 changes: 1 addition & 1 deletion src/graph/visitor/PropertyTrackerVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#define GRAPH_VISITOR_PROPERTYTRACKERVISITOR_H

#include "common/base/Status.h"
#include "common/expression/ExprVisitorImpl.h"
#include "common/thrift/ThriftTypes.h"
#include "graph/visitor/ExprVisitorImpl.h"

namespace nebula {

Expand Down
2 changes: 1 addition & 1 deletion src/graph/visitor/RewriteVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <functional>

#include "graph/visitor/ExprVisitorImpl.h"
#include "common/expression/ExprVisitorImpl.h"

namespace nebula {
namespace graph {
Expand Down
2 changes: 1 addition & 1 deletion src/graph/visitor/ValidatePatternExpressionVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// This source code is licensed under Apache 2.0 License.
#include "graph/visitor/ValidatePatternExpressionVisitor.h"

#include "ExprVisitorImpl.h"
#include "common/expression/ExprVisitorImpl.h"
#include "graph/context/ValidateContext.h"

namespace nebula {
Expand Down
2 changes: 1 addition & 1 deletion src/graph/visitor/ValidatePatternExpressionVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#pragma once

#include "common/expression/ExprVisitorImpl.h"
#include "common/expression/Expression.h"
#include "graph/visitor/ExprVisitorImpl.h"

namespace nebula {
namespace graph {
Expand Down
1 change: 0 additions & 1 deletion src/storage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ nebula_add_library(
nebula_add_library(
graph_storage_service_handler OBJECT
GraphStorageServiceHandler.cpp
ExprVisitorBase.cpp
context/StorageExpressionContext.cpp
mutate/AddVerticesProcessor.cpp
mutate/DeleteVerticesProcessor.cpp
Expand Down
150 changes: 0 additions & 150 deletions src/storage/ExprVisitorBase.cpp

This file was deleted.

Loading