Skip to content

Commit

Permalink
fix test error
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed Dec 16, 2021
1 parent 26bf0cf commit 2186f33
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.
23 changes: 2 additions & 21 deletions src/graph/validator/LookupValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Status LookupValidator::validateImpl() {
lookupCtx_ = getContext<LookupContext>();

NG_RETURN_IF_ERROR(validateFrom());
NG_RETURN_IF_ERROR(validateFilter());
NG_RETURN_IF_ERROR(validateWhere());
NG_RETURN_IF_ERROR(validateYield());
return Status::OK();
}
Expand All @@ -57,19 +57,6 @@ Status LookupValidator::validateFrom() {
return Status::OK();
}

Status LookupValidator::extractSchemaProp() {
shared_ptr<const NebulaSchemaProvider> schema;
NG_RETURN_IF_ERROR(getSchemaProvider(&schema));
for (std::size_t i = 0; i < schema->getNumFields(); ++i) {
const auto& propName = schema->getFieldName(i);
auto iter = std::find(idxReturnCols_.begin(), idxReturnCols_.end(), propName);
if (iter == idxReturnCols_.end()) {
idxReturnCols_.emplace_back(propName);
}
}
return Status::OK();
}

void LookupValidator::extractExprProps() {
auto addProps = [this](const std::set<folly::StringPiece>& propNames) {
for (const auto& propName : propNames) {
Expand Down Expand Up @@ -108,9 +95,6 @@ Status LookupValidator::validateYieldEdge() {
{Expression::Kind::kAggregate, Expression::Kind::kVertex})) {
return Status::SemanticError("illegal yield clauses `%s'", col->toString().c_str());
}
if (ExpressionUtils::hasAny(col->expr(), {Expression::Kind::kEdge})) {
NG_RETURN_IF_ERROR(extractSchemaProp());
}
if (col->expr()->kind() == Expression::Kind::kLabelAttribute) {
const auto& schemaName = static_cast<LabelAttributeExpression*>(col->expr())->left()->name();
if (schemaName != sentence()->from()) {
Expand Down Expand Up @@ -138,9 +122,6 @@ Status LookupValidator::validateYieldTag() {
{Expression::Kind::kAggregate, Expression::Kind::kEdge})) {
return Status::SemanticError("illegal yield clauses `%s'", col->toString().c_str());
}
if (ExpressionUtils::hasAny(col->expr(), {Expression::Kind::kVertex})) {
NG_RETURN_IF_ERROR(extractSchemaProp());
}
if (col->expr()->kind() == Expression::Kind::kLabelAttribute) {
const auto& schemaName = static_cast<LabelAttributeExpression*>(col->expr())->left()->name();
if (schemaName != sentence()->from()) {
Expand Down Expand Up @@ -188,7 +169,7 @@ Status LookupValidator::validateYield() {
return Status::OK();
}

Status LookupValidator::validateFilter() {
Status LookupValidator::validateWhere() {
auto whereClause = sentence()->whereClause();
if (whereClause == nullptr) {
return Status::OK();
Expand Down
3 changes: 1 addition & 2 deletions src/graph/validator/LookupValidator.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class LookupValidator final : public Validator {

Status validateFrom();
Status validateYield();
Status validateFilter();
Status validateWhere();
Status validateYieldTag();
Status validateYieldEdge();

Expand All @@ -53,7 +53,6 @@ class LookupValidator final : public Validator {
Status getSchemaProvider(std::shared_ptr<const meta::NebulaSchemaProvider>* provider) const;
StatusOr<Expression*> genTsFilter(Expression* filter);
StatusOr<Expression*> handleLogicalExprOperands(LogicalExpression* lExpr);
Status extractSchemaProp();
void extractExprProps();

std::unique_ptr<LookupContext> lookupCtx_;
Expand Down
2 changes: 1 addition & 1 deletion src/graph/validator/YieldValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Status YieldValidator::makeOutputColumn(YieldColumn *column) {
DCHECK(colExpr != nullptr);

auto expr = colExpr->clone();
NG_RETURN_IF_ERROR(deduceProps(expr, exprProps_, {}, {}));
NG_RETURN_IF_ERROR(deduceProps(expr, exprProps_));

auto status = deduceExprType(expr);
NG_RETURN_IF_ERROR(status);
Expand Down

0 comments on commit 2186f33

Please sign in to comment.