Skip to content

Commit

Permalink
rename visitor
Browse files Browse the repository at this point in the history
  • Loading branch information
jievince committed Jan 21, 2022
1 parent a313e6b commit bddd2a9
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions src/graph/util/ExpressionUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include "common/thrift/ThriftTypes.h"
#include "graph/context/QueryContext.h"
#include "graph/context/QueryExpressionContext.h"
#include "graph/visitor/DeduceMatchPropsVisitor.h"
#include "graph/visitor/FoldConstantExprVisitor.h"
#include "graph/visitor/PropertyTrackerVisitor.h"

DEFINE_int32(max_expression_depth, 512, "Max depth of expression tree.");

Expand Down Expand Up @@ -1066,7 +1066,7 @@ Status ExpressionUtils::extractPropsFromExprs(const Expression *expr,
const graph::QueryContext *qctx,
GraphSpaceID spaceID,
const std::string &entityAlias) {
DeduceMatchPropsVisitor visitor(qctx, spaceID, propsUsed, entityAlias);
PropertyTrackerVisitor visitor(qctx, spaceID, propsUsed, entityAlias);
const_cast<Expression *>(expr)->accept(&visitor);
if (!visitor.ok()) {
return visitor.status();
Expand Down
2 changes: 1 addition & 1 deletion src/graph/visitor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ nebula_add_library(
expr_visitor_obj OBJECT
ExprVisitorImpl.cpp
DeducePropsVisitor.cpp
DeduceMatchPropsVisitor.cpp
PropertyTrackerVisitor.cpp
DeduceTypeVisitor.cpp
ExtractPropExprVisitor.cpp
ExtractFilterExprVisitor.cpp
Expand Down
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/DeduceMatchPropsVisitor.h"
#include "graph/visitor/PropertyTrackerVisitor.h"

#include <sstream>

Expand All @@ -14,15 +14,15 @@ namespace nebula {
namespace graph {

// visitor
DeduceMatchPropsVisitor::DeduceMatchPropsVisitor(const QueryContext *qctx,
GraphSpaceID space,
PropertyTracker &propsUsed,
const std::string &entityAlias)
PropertyTrackerVisitor::PropertyTrackerVisitor(const QueryContext *qctx,
GraphSpaceID space,
PropertyTracker &propsUsed,
const std::string &entityAlias)
: qctx_(qctx), space_(space), propsUsed_(propsUsed), entityAlias_(entityAlias) {
DCHECK(qctx != nullptr);
}

void DeduceMatchPropsVisitor::visit(TagPropertyExpression *expr) {
void PropertyTrackerVisitor::visit(TagPropertyExpression *expr) {
auto &tagName = expr->sym();
auto &propName = expr->prop();
auto ret = qctx_->schemaMng()->toTagID(space_, tagName);
Expand All @@ -34,7 +34,7 @@ void DeduceMatchPropsVisitor::visit(TagPropertyExpression *expr) {
propsUsed_.vertexPropsMap[entityAlias_][tagId].emplace(propName);
}

void DeduceMatchPropsVisitor::visit(EdgePropertyExpression *expr) {
void PropertyTrackerVisitor::visit(EdgePropertyExpression *expr) {
auto &edgeName = expr->sym();
auto &propName = expr->prop();
auto ret = qctx_->schemaMng()->toEdgeType(space_, edgeName);
Expand All @@ -46,7 +46,7 @@ void DeduceMatchPropsVisitor::visit(EdgePropertyExpression *expr) {
propsUsed_.edgePropsMap[entityAlias_][edgeType].emplace(propName);
}

void DeduceMatchPropsVisitor::visit(LabelTagPropertyExpression *expr) {
void PropertyTrackerVisitor::visit(LabelTagPropertyExpression *expr) {
auto status = qctx_->schemaMng()->toTagID(space_, expr->sym());
if (!status.ok()) {
status_ = std::move(status).status();
Expand All @@ -64,17 +64,17 @@ void DeduceMatchPropsVisitor::visit(LabelTagPropertyExpression *expr) {
propsUsed_.vertexPropsMap[nodeAlias][tagId].emplace(propName);
}

void DeduceMatchPropsVisitor::visit(InputPropertyExpression *expr) {
void PropertyTrackerVisitor::visit(InputPropertyExpression *expr) {
auto &colName = expr->prop();
propsUsed_.colsSet.emplace(colName);
}

void DeduceMatchPropsVisitor::visit(VariablePropertyExpression *expr) {
void PropertyTrackerVisitor::visit(VariablePropertyExpression *expr) {
auto &colName = expr->prop();
propsUsed_.colsSet.emplace(colName);
}

// void DeduceMatchPropsVisitor::visit(AttributeExpression *expr) {
// void PropertyTrackerVisitor::visit(AttributeExpression *expr) {
// auto *lhs = expr->left();
// auto *rhs = expr->right();
// if (rhs->kind() != Expression::Kind::kConstant) {
Expand Down Expand Up @@ -109,7 +109,7 @@ void DeduceMatchPropsVisitor::visit(VariablePropertyExpression *expr) {
// }
// }

void DeduceMatchPropsVisitor::visit(FunctionCallExpression *expr) {
void PropertyTrackerVisitor::visit(FunctionCallExpression *expr) {
auto funName = expr->name();
if (funName == "id" || funName == "src" || funName == "dst") {
return;
Expand All @@ -122,63 +122,63 @@ void DeduceMatchPropsVisitor::visit(FunctionCallExpression *expr) {
}
}

void DeduceMatchPropsVisitor::visit(DestPropertyExpression *expr) {
void PropertyTrackerVisitor::visit(DestPropertyExpression *expr) {
UNUSED(expr);
}

void DeduceMatchPropsVisitor::visit(SourcePropertyExpression *expr) {
void PropertyTrackerVisitor::visit(SourcePropertyExpression *expr) {
UNUSED(expr);
}

void DeduceMatchPropsVisitor::visit(EdgeSrcIdExpression *expr) {
void PropertyTrackerVisitor::visit(EdgeSrcIdExpression *expr) {
UNUSED(expr);
}

void DeduceMatchPropsVisitor::visit(EdgeTypeExpression *expr) {
void PropertyTrackerVisitor::visit(EdgeTypeExpression *expr) {
UNUSED(expr);
}

void DeduceMatchPropsVisitor::visit(EdgeRankExpression *expr) {
void PropertyTrackerVisitor::visit(EdgeRankExpression *expr) {
UNUSED(expr);
}

void DeduceMatchPropsVisitor::visit(EdgeDstIdExpression *expr) {
void PropertyTrackerVisitor::visit(EdgeDstIdExpression *expr) {
UNUSED(expr);
}

void DeduceMatchPropsVisitor::visit(UUIDExpression *expr) {
void PropertyTrackerVisitor::visit(UUIDExpression *expr) {
UNUSED(expr);
}

void DeduceMatchPropsVisitor::visit(VariableExpression *expr) {
void PropertyTrackerVisitor::visit(VariableExpression *expr) {
UNUSED(expr);
}

void DeduceMatchPropsVisitor::visit(VersionedVariableExpression *expr) {
void PropertyTrackerVisitor::visit(VersionedVariableExpression *expr) {
UNUSED(expr);
}

void DeduceMatchPropsVisitor::visit(LabelExpression *expr) {
void PropertyTrackerVisitor::visit(LabelExpression *expr) {
UNUSED(expr);
}

void DeduceMatchPropsVisitor::visit(LabelAttributeExpression *expr) {
void PropertyTrackerVisitor::visit(LabelAttributeExpression *expr) {
UNUSED(expr);
}

void DeduceMatchPropsVisitor::visit(ConstantExpression *expr) {
void PropertyTrackerVisitor::visit(ConstantExpression *expr) {
UNUSED(expr);
}

void DeduceMatchPropsVisitor::visit(ColumnExpression *expr) {
void PropertyTrackerVisitor::visit(ColumnExpression *expr) {
UNUSED(expr);
}

void DeduceMatchPropsVisitor::visit(VertexExpression *expr) {
void PropertyTrackerVisitor::visit(VertexExpression *expr) {
UNUSED(expr);
}

void DeduceMatchPropsVisitor::visit(EdgeExpression *expr) {
void PropertyTrackerVisitor::visit(EdgeExpression *expr) {
UNUSED(expr);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* This source code is licensed under Apache 2.0 License.
*/

#ifndef GRAPH_VISITOR_DEDUCEMATCHPROPSVISITOR_H
#define GRAPH_VISITOR_DEDUCEMATCHPROPSVISITOR_H
#ifndef GRAPH_VISITOR_PROPERTYTRACKERVISITOR_H
#define GRAPH_VISITOR_PROPERTYTRACKERVISITOR_H

#include "common/base/Status.h"
#include "common/expression/FunctionCallExpression.h"
Expand All @@ -21,12 +21,12 @@ namespace graph {

class QueryContext;

class DeduceMatchPropsVisitor : public ExprVisitorImpl {
class PropertyTrackerVisitor : public ExprVisitorImpl {
public:
DeduceMatchPropsVisitor(const QueryContext* qctx,
GraphSpaceID space,
PropertyTracker& propsUsed,
const std::string& entityAlias);
PropertyTrackerVisitor(const QueryContext* qctx,
GraphSpaceID space,
PropertyTracker& propsUsed,
const std::string& entityAlias);

bool ok() const override {
return status_.ok();
Expand Down Expand Up @@ -73,4 +73,4 @@ class DeduceMatchPropsVisitor : public ExprVisitorImpl {
} // namespace graph
} // namespace nebula

#endif // GRAPH_VISITOR_DEDUCEMATCHPROPSVISITOR_H
#endif // GRAPH_VISITOR_PROPERTYTRACKERVISITOR_H

0 comments on commit bddd2a9

Please sign in to comment.