diff --git a/src/common/expression/ExprVisitor.h b/src/common/expression/ExprVisitor.h index 5b73c1d5978..c4a079cd706 100644 --- a/src/common/expression/ExprVisitor.h +++ b/src/common/expression/ExprVisitor.h @@ -62,6 +62,7 @@ class ExprVisitor { virtual void visit(MapExpression *expr) = 0; // property Expression virtual void visit(TagPropertyExpression *expr) = 0; + virtual void visit(LabelTagPropertyExpression *expr) = 0; virtual void visit(EdgePropertyExpression *expr) = 0; virtual void visit(InputPropertyExpression *expr) = 0; virtual void visit(VariablePropertyExpression *expr) = 0; diff --git a/src/common/expression/Expression.cpp b/src/common/expression/Expression.cpp index 16ff1c276e6..f6cacf218ec 100644 --- a/src/common/expression/Expression.cpp +++ b/src/common/expression/Expression.cpp @@ -354,6 +354,11 @@ Expression* Expression::decode(ObjectPool* pool, Expression::Decoder& decoder) { exp->resetFrom(decoder); return exp; } + case Expression::Kind::kLabelTagProperty: { + exp = LabelTagPropertyExpression::make(pool); + exp->resetFrom(decoder); + return exp; + } case Expression::Kind::kLabelAttribute: { exp = LabelAttributeExpression::make(pool); exp->resetFrom(decoder); @@ -394,7 +399,8 @@ Expression* Expression::decode(ObjectPool* pool, Expression::Decoder& decoder) { return exp; } case Expression::Kind::kVarProperty: { - LOG(FATAL) << "Should not decode variable property expression"; + exp = VariablePropertyExpression::make(pool); + exp->resetFrom(decoder); return exp; } case Expression::Kind::kDstProperty: { @@ -626,6 +632,9 @@ std::ostream& operator<<(std::ostream& os, Expression::Kind kind) { case Expression::Kind::kLabelAttribute: os << "LabelAttribute"; break; + case Expression::Kind::kLabelTagProperty: + os << "LabelTagProperty"; + break; case Expression::Kind::kLogicalAnd: os << "LogicalAnd"; break; diff --git a/src/common/expression/Expression.h b/src/common/expression/Expression.h index 1f5a1aacd66..96bb68451d0 100644 --- a/src/common/expression/Expression.h +++ b/src/common/expression/Expression.h @@ -64,6 +64,7 @@ class Expression { kFunctionCall, // Vertex/Edge/Path kTagProperty, + kLabelTagProperty, kEdgeProperty, kInputProperty, kVarProperty, diff --git a/src/common/expression/PredicateExpression.cpp b/src/common/expression/PredicateExpression.cpp index 1ff92618e9f..e182baab801 100644 --- a/src/common/expression/PredicateExpression.cpp +++ b/src/common/expression/PredicateExpression.cpp @@ -18,7 +18,13 @@ std::unordered_map PredicateExpression:: const Value& PredicateExpression::evalExists(ExpressionContext& ctx) { DCHECK(collection_->kind() == Expression::Kind::kAttribute || - collection_->kind() == Expression::Kind::kSubscript); + collection_->kind() == Expression::Kind::kSubscript || + collection_->kind() == Expression::Kind::kLabelTagProperty); + + if (collection_->kind() == Expression::Kind::kLabelTagProperty) { + result_ = !collection_->eval(ctx).isNull(); + return result_; + } auto* attributeExpr = static_cast(collection_); auto& container = attributeExpr->left()->eval(ctx); diff --git a/src/common/expression/PropertyExpression.cpp b/src/common/expression/PropertyExpression.cpp index df44262eebd..2de198f87b3 100644 --- a/src/common/expression/PropertyExpression.cpp +++ b/src/common/expression/PropertyExpression.cpp @@ -174,4 +174,47 @@ std::string VariablePropertyExpression::toString() const { return buf; } +const Value& LabelTagPropertyExpression::eval(ExpressionContext& ctx) { + const auto& var = label_->eval(ctx); + if (var.type() != Value::Type::VERTEX) { + return Value::kNullBadType; + } + for (const auto& tag : var.getVertex().tags) { + if (tag.name == sym_) { + auto iter = tag.props.find(prop_); + if (iter != tag.props.end()) { + return iter->second; + } + } + } + return Value::kNullValue; +} + +void LabelTagPropertyExpression::accept(ExprVisitor* visitor) { + visitor->visit(this); +} + +std::string LabelTagPropertyExpression::toString() const { + std::string labelStr = label_ != nullptr ? label_->toString().erase(0, 1) : ""; + return labelStr + "." + sym_ + "." + prop_; +} + +bool LabelTagPropertyExpression::operator==(const Expression& rhs) const { + if (kind_ != rhs.kind()) { + return false; + } + const auto& expr = static_cast(rhs); + return *label_ == *expr.label_ && sym_ == expr.sym_ && prop_ == expr.prop_; +} + +void LabelTagPropertyExpression::writeTo(Encoder& encoder) const { + PropertyExpression::writeTo(encoder); + encoder << *label_; +} + +void LabelTagPropertyExpression::resetFrom(Decoder& decoder) { + PropertyExpression::resetFrom(decoder); + label_ = decoder.readExpression(pool_); +} + } // namespace nebula diff --git a/src/common/expression/PropertyExpression.h b/src/common/expression/PropertyExpression.h index 4a5e7e8bd23..26cf1cee943 100644 --- a/src/common/expression/PropertyExpression.h +++ b/src/common/expression/PropertyExpression.h @@ -122,6 +122,53 @@ class TagPropertyExpression final : public PropertyExpression { Value result_; }; +// label.tag_name.any_prop_name +class LabelTagPropertyExpression final : public PropertyExpression { + public: + LabelTagPropertyExpression& operator=(const LabelTagPropertyExpression& rhs) = delete; + LabelTagPropertyExpression& operator=(LabelTagPropertyExpression&&) = delete; + + static LabelTagPropertyExpression* make(ObjectPool* pool, + Expression* label = nullptr, + const std::string& tag = "", + const std::string& prop = "") { + return pool->add(new LabelTagPropertyExpression(pool, label, tag, prop)); + } + + std::string toString() const override; + + bool operator==(const Expression& rhs) const override; + + const Value& eval(ExpressionContext& ctx) override; + + void accept(ExprVisitor* visitor) override; + + Expression* clone() const override { + return LabelTagPropertyExpression::make(pool_, label_, sym(), prop()); + } + + const Expression* label() const { + return label_; + } + + Expression* label() { + return label_; + } + + private: + LabelTagPropertyExpression(ObjectPool* pool, + Expression* label = nullptr, + const std::string& tag = "", + const std::string& prop = "") + : PropertyExpression(pool, Kind::kLabelTagProperty, "", tag, prop), label_(label) {} + + void writeTo(Encoder& encoder) const override; + void resetFrom(Decoder& decoder) override; + + private: + Expression* label_{nullptr}; +}; + // $-.any_prop_name class InputPropertyExpression final : public PropertyExpression { public: diff --git a/src/graph/optimizer/rule/IndexScanRule.cpp b/src/graph/optimizer/rule/IndexScanRule.cpp index 9197e26d119..f1ae0ea24af 100644 --- a/src/graph/optimizer/rule/IndexScanRule.cpp +++ b/src/graph/optimizer/rule/IndexScanRule.cpp @@ -4,10 +4,6 @@ */ #include "graph/optimizer/rule/IndexScanRule.h" - -#include "common/expression/LabelAttributeExpression.h" -#include "common/expression/VariableExpression.h" -#include "graph/context/QueryExpressionContext.h" #include "graph/optimizer/OptContext.h" #include "graph/optimizer/OptGroup.h" #include "graph/optimizer/OptRule.h" @@ -18,10 +14,10 @@ #include "graph/util/IndexUtil.h" #include "graph/visitor/RewriteVisitor.h" +using nebula::graph::ExpressionUtils; using nebula::graph::IndexScan; using nebula::graph::IndexUtil; using nebula::graph::OptimizerUtils; - using IndexQueryCtx = std::vector; namespace nebula { @@ -378,9 +374,13 @@ Status IndexScanRule::analyzeExpression( case Expression::Kind::kRelGT: case Expression::Kind::kRelNE: { auto* rExpr = static_cast(expr); - auto ret = isEdge ? addFilterItem(rExpr, items, qctx) - : addFilterItem(rExpr, items, qctx); - NG_RETURN_IF_ERROR(ret); + if (isEdge) { + NG_RETURN_IF_ERROR(addFilterItem(rExpr, items, qctx)); + } else if (ExpressionUtils::hasAny(rExpr, {Expression::Kind::kLabelTagProperty})) { + NG_RETURN_IF_ERROR(addFilterItem(rExpr, items, qctx)); + } else { + NG_RETURN_IF_ERROR(addFilterItem(rExpr, items, qctx)); + } if (kind->getKind() == ScanKind::Kind::kMultipleScan && expr->kind() == Expression::Kind::kRelNE) { kind->setKind(ScanKind::Kind::kSingleScan); @@ -400,8 +400,14 @@ Status IndexScanRule::addFilterItem(RelationalExpression* expr, FilterItems* items, QueryContext* qctx) const { // TODO (sky) : Check illegal filter. for example : where c1 == 1 and c1 == 2 - auto relType = std::is_same::value ? Expression::Kind::kEdgeProperty - : Expression::Kind::kTagProperty; + Expression::Kind relType; + if constexpr (std::is_same::value) { + relType = Expression::Kind::kEdgeProperty; + } else if constexpr (std::is_same::value) { + relType = Expression::Kind::kLabelTagProperty; + } else { + relType = Expression::Kind::kTagProperty; + } if (expr->left()->kind() == relType && graph::ExpressionUtils::isEvaluableExpr(expr->right(), qctx)) { auto* l = static_cast(expr->left()); @@ -515,7 +521,7 @@ std::vector IndexScanRule::findValidIndex(graph::QueryContext* qctx, return item.col_ == fields[0].get_name(); }); if (it == items.items.end()) { - validIndexes.erase(index); + index = validIndexes.erase(index); } else { index++; } diff --git a/src/graph/optimizer/rule/IndexScanRule.h b/src/graph/optimizer/rule/IndexScanRule.h index 62dec57d536..e9ad0393993 100644 --- a/src/graph/optimizer/rule/IndexScanRule.h +++ b/src/graph/optimizer/rule/IndexScanRule.h @@ -135,6 +135,7 @@ class IndexScanRule final : public OptRule { template ::value || + std::is_same::value || std::is_same::value>> Status addFilterItem(RelationalExpression* expr, FilterItems* items, QueryContext* qctx) const; diff --git a/src/graph/optimizer/rule/PushFilterDownProjectRule.cpp b/src/graph/optimizer/rule/PushFilterDownProjectRule.cpp index df410b8378a..4eb89bbf13d 100644 --- a/src/graph/optimizer/rule/PushFilterDownProjectRule.cpp +++ b/src/graph/optimizer/rule/PushFilterDownProjectRule.cpp @@ -50,6 +50,7 @@ StatusOr PushFilterDownProjectRule::transform( auto picker = [&projColumns, &projColNames, &rewriteMap](const Expression* e) -> bool { auto varProps = graph::ExpressionUtils::collectAll(e, {Expression::Kind::kTagProperty, + Expression::Kind::kLabelTagProperty, Expression::Kind::kEdgeProperty, Expression::Kind::kInputProperty, Expression::Kind::kVarProperty, diff --git a/src/graph/planner/match/LabelIndexSeek.cpp b/src/graph/planner/match/LabelIndexSeek.cpp index 93418180e3e..5a2c66153e1 100644 --- a/src/graph/planner/match/LabelIndexSeek.cpp +++ b/src/graph/planner/match/LabelIndexSeek.cpp @@ -91,11 +91,11 @@ StatusOr LabelIndexSeek::transformNode(NodeContext* nodeCtx) { const auto& nodeAlias = nodeCtx->info->alias; if (filter->kind() == Expression::Kind::kLogicalOr) { - auto labelExprs = ExpressionUtils::collectAll(filter, {Expression::Kind::kLabel}); + auto exprs = ExpressionUtils::collectAll(filter, {Expression::Kind::kLabelTagProperty}); bool labelMatched = true; - for (auto* labelExpr : labelExprs) { - DCHECK_EQ(labelExpr->kind(), Expression::Kind::kLabel); - if (static_cast(labelExpr)->name() != nodeAlias) { + for (auto* expr : exprs) { + auto tagPropExpr = static_cast(expr); + if (static_cast(tagPropExpr->label())->prop() != nodeAlias) { labelMatched = false; break; } @@ -117,9 +117,8 @@ StatusOr LabelIndexSeek::transformNode(NodeContext* nodeCtx) { } } if (canBeEmbedded2IndexScan) { - auto* srcFilter = ExpressionUtils::rewriteLabelAttr2TagProp(flattenFilter); storage::cpp2::IndexQueryContext ctx; - ctx.filter_ref() = Expression::encode(*srcFilter); + ctx.filter_ref() = Expression::encode(*flattenFilter); scan->setIndexQueryContext({ctx}); whereCtx.reset(); } diff --git a/src/graph/planner/match/MatchSolver.cpp b/src/graph/planner/match/MatchSolver.cpp index 825eb2ad1ab..14152c50934 100644 --- a/src/graph/planner/match/MatchSolver.cpp +++ b/src/graph/planner/match/MatchSolver.cpp @@ -78,7 +78,6 @@ Expression* MatchSolver::doRewrite(QueryContext* qctx, auto alias = aliases.find(labelExpr->name()); DCHECK(alias != aliases.end()); } - return rewriteLabel2VarProp(qctx, expr); } @@ -141,32 +140,52 @@ Expression* MatchSolver::makeIndexFilter(const std::string& label, auto* binary = static_cast(item); auto* left = binary->left(); auto* right = binary->right(); - const LabelAttributeExpression* la = nullptr; const ConstantExpression* constant = nullptr; + std::string propName; // TODO(aiee) extract the logic that applies to both match and lookup - if (left->kind() == Expression::Kind::kLabelAttribute && - right->kind() == Expression::Kind::kConstant) { - la = static_cast(left); - constant = static_cast(right); - } else if (right->kind() == Expression::Kind::kLabelAttribute && - left->kind() == Expression::Kind::kConstant) { - la = static_cast(right); - constant = static_cast(left); + if (isEdgeProperties) { + const LabelAttributeExpression* la = nullptr; + if (left->kind() == Expression::Kind::kLabelAttribute && + right->kind() == Expression::Kind::kConstant) { + la = static_cast(left); + constant = static_cast(right); + } else if (right->kind() == Expression::Kind::kLabelAttribute && + left->kind() == Expression::Kind::kConstant) { + la = static_cast(right); + constant = static_cast(left); + } else { + continue; + } + if (la->left()->name() != alias) { + continue; + } + propName = la->right()->value().getStr(); } else { - continue; - } - - if (la->left()->name() != alias) { - continue; + const LabelTagPropertyExpression* la = nullptr; + if (left->kind() == Expression::Kind::kLabelTagProperty && + right->kind() == Expression::Kind::kConstant) { + la = static_cast(left); + constant = static_cast(right); + } else if (right->kind() == Expression::Kind::kLabelTagProperty && + left->kind() == Expression::Kind::kConstant) { + la = static_cast(right); + constant = static_cast(left); + } else { + continue; + } + if (static_cast(la->label())->prop() != alias || + la->sym() != label) { + continue; + } + propName = la->prop(); } - const auto& value = la->right()->value(); auto* tpExpr = isEdgeProperties - ? static_cast(EdgePropertyExpression::make(pool, label, value.getStr())) - : static_cast(TagPropertyExpression::make(pool, label, value.getStr())); + ? static_cast(EdgePropertyExpression::make(pool, label, propName)) + : static_cast(TagPropertyExpression::make(pool, label, propName)); auto* newConstant = constant->clone(); - if (left->kind() == Expression::Kind::kLabelAttribute) { + if (right->kind() == Expression::Kind::kConstant) { auto* rel = RelationalExpression::makeKind(pool, item->kind(), tpExpr, newConstant); relationals.emplace_back(rel); } else { diff --git a/src/graph/util/ExpressionUtils.cpp b/src/graph/util/ExpressionUtils.cpp index 44158f7461f..22e7d80c247 100644 --- a/src/graph/util/ExpressionUtils.cpp +++ b/src/graph/util/ExpressionUtils.cpp @@ -21,6 +21,7 @@ bool ExpressionUtils::isPropertyExpr(const Expression *expr) { auto kind = expr->kind(); return std::unordered_set{Expression::Kind::kTagProperty, + Expression::Kind::kLabelTagProperty, Expression::Kind::kEdgeProperty, Expression::Kind::kInputProperty, Expression::Kind::kVarProperty, @@ -78,6 +79,7 @@ bool ExpressionUtils::checkVarExprIfExist(const Expression *expr, const QueryCon std::vector ExpressionUtils::findAllStorage(const Expression *expr) { return collectAll(expr, {Expression::Kind::kTagProperty, + Expression::Kind::kLabelTagProperty, Expression::Kind::kEdgeProperty, Expression::Kind::kDstProperty, Expression::Kind::kSrcProperty, @@ -100,6 +102,7 @@ bool ExpressionUtils::isConstExpr(const Expression *expr) { Expression::Kind::kVar, Expression::Kind::kVersionedVar, Expression::Kind::kLabelAttribute, + Expression::Kind::kLabelTagProperty, Expression::Kind::kTagProperty, Expression::Kind::kEdgeProperty, Expression::Kind::kDstProperty, @@ -118,6 +121,38 @@ bool ExpressionUtils::isEvaluableExpr(const Expression *expr, const QueryContext return visitor.ok(); } +// rewrite Attribute to LabelTagProp +Expression *ExpressionUtils::rewriteAttr2LabelTagProp(const Expression *expr) { + ObjectPool *pool = expr->getObjPool(); + + auto matcher = [](const Expression *e) -> bool { + if (e->kind() == Expression::Kind::kAttribute) { + auto attrExpr = static_cast(e); + if (attrExpr->left()->kind() == Expression::Kind::kLabelAttribute && + attrExpr->right()->kind() == Expression::Kind::kConstant) { + return true; + } + } + return false; + }; + + auto rewriter = [pool](const Expression *e) -> Expression * { + auto attrExpr = static_cast(e); + auto labelAttrExpr = static_cast(attrExpr->left()); + auto labelExpr = const_cast(labelAttrExpr->left()); + auto tagExpr = const_cast(labelAttrExpr->right()); + auto propExpr = static_cast(attrExpr->right()); + QueryExpressionContext ctx(nullptr); + const auto &labelVal = labelExpr->eval(ctx); + auto label = VariablePropertyExpression::make(pool, "", labelVal.getStr()); + const auto &tag = tagExpr->eval(ctx); + const auto &prop = const_cast(propExpr)->eval(ctx); + return LabelTagPropertyExpression::make(pool, label, tag.getStr(), prop.getStr()); + }; + + return RewriteVisitor::transform(expr, std::move(matcher), std::move(rewriter)); +} + // rewrite LabelAttr to EdgeProp Expression *ExpressionUtils::rewriteLabelAttr2EdgeProp(const Expression *expr) { ObjectPool *pool = expr->getObjPool(); @@ -125,7 +160,6 @@ Expression *ExpressionUtils::rewriteLabelAttr2EdgeProp(const Expression *expr) { return e->kind() == Expression::Kind::kLabelAttribute; }; auto rewriter = [pool](const Expression *e) -> Expression * { - DCHECK_EQ(e->kind(), Expression::Kind::kLabelAttribute); auto labelAttrExpr = static_cast(e); auto leftName = labelAttrExpr->left()->name(); auto rightName = labelAttrExpr->right()->value().getStr(); @@ -142,7 +176,6 @@ Expression *ExpressionUtils::rewriteInnerVar(const Expression *expr, std::string return e->kind() == Expression::Kind::kVarProperty; }; auto rewriter = [pool, newVar](const Expression *e) -> Expression * { - DCHECK_EQ(e->kind(), Expression::Kind::kVarProperty); auto varPropExpr = static_cast(e); auto newProp = varPropExpr->prop(); return VariablePropertyExpression::make(pool, newVar, newProp); @@ -173,7 +206,6 @@ Expression *ExpressionUtils::rewriteLabelAttr2TagProp(const Expression *expr) { return e->kind() == Expression::Kind::kLabelAttribute; }; auto rewriter = [pool](const Expression *e) -> Expression * { - DCHECK_EQ(e->kind(), Expression::Kind::kLabelAttribute); auto labelAttrExpr = static_cast(e); auto leftName = labelAttrExpr->left()->name(); auto rightName = labelAttrExpr->right()->value().getStr(); @@ -423,8 +455,7 @@ Expression *ExpressionUtils::rewriteRelExpr(const Expression *expr) { return nullptr; }; - std::function rewriter = - [&](const Expression *e) -> Expression * { + auto rewriter = [&](const Expression *e) -> Expression * { auto exprCopy = e->clone(); auto relExpr = static_cast(exprCopy); auto lExpr = relExpr->left(); diff --git a/src/graph/util/ExpressionUtils.h b/src/graph/util/ExpressionUtils.h index 2ead1aa54eb..19193cb7a86 100644 --- a/src/graph/util/ExpressionUtils.h +++ b/src/graph/util/ExpressionUtils.h @@ -55,6 +55,8 @@ class ExpressionUtils { static bool isEvaluableExpr(const Expression* expr, const QueryContext* qctx = nullptr); + static Expression* rewriteAttr2LabelTagProp(const Expression* expr); + static Expression* rewriteLabelAttr2TagProp(const Expression* expr); static Expression* rewriteLabelAttr2EdgeProp(const Expression* expr); diff --git a/src/graph/validator/GoValidator.cpp b/src/graph/validator/GoValidator.cpp index 69b5a9bbd39..cfb6b55f2dd 100644 --- a/src/graph/validator/GoValidator.cpp +++ b/src/graph/validator/GoValidator.cpp @@ -5,7 +5,6 @@ #include "graph/validator/GoValidator.h" -#include "common/expression/VariableExpression.h" #include "graph/planner/plan/Logic.h" #include "graph/util/ExpressionUtils.h" #include "graph/util/ValidateUtil.h" diff --git a/src/graph/validator/MatchValidator.cpp b/src/graph/validator/MatchValidator.cpp index 90f1668ceac..2f704d8e53d 100644 --- a/src/graph/validator/MatchValidator.cpp +++ b/src/graph/validator/MatchValidator.cpp @@ -272,7 +272,8 @@ Status MatchValidator::validateFilter(const Expression *filter, WhereClauseContext &whereClauseCtx) const { auto transformRes = ExpressionUtils::filterTransform(filter); NG_RETURN_IF_ERROR(transformRes); - whereClauseCtx.filter = transformRes.value(); + // rewrite Attribute to LabelTagProperty + whereClauseCtx.filter = ExpressionUtils::rewriteAttr2LabelTagProp(transformRes.value()); auto typeStatus = deduceExprType(whereClauseCtx.filter); NG_RETURN_IF_ERROR(typeStatus); @@ -368,7 +369,9 @@ Status MatchValidator::validateReturn(MatchReturn *ret, return Status::SemanticError("RETURN * is not allowed when there are no variables in scope"); } } + std::vector exprs; if (ret->returnItems()->columns()) { + exprs.reserve(ret->returnItems()->columns()->size()); for (auto *column : ret->returnItems()->columns()->columns()) { if (ExpressionUtils::hasAny(column->expr(), {Expression::Kind::kVertex, Expression::Kind::kEdge})) { @@ -376,22 +379,18 @@ Status MatchValidator::validateReturn(MatchReturn *ret, "keywords: vertex and edge are not supported in return clause `%s'", column->toString().c_str()); } + if (!retClauseCtx.yield->hasAgg_ && + ExpressionUtils::hasAny(column->expr(), {Expression::Kind::kAggregate})) { + retClauseCtx.yield->hasAgg_ = true; + } + column->setExpr(ExpressionUtils::rewriteAttr2LabelTagProp(column->expr())); + exprs.push_back(column->expr()); columns->addColumn(column->clone().release()); } } DCHECK(!columns->empty()); retClauseCtx.yield->yieldColumns = columns; - // Check all referencing expressions are valid - std::vector exprs; - exprs.reserve(retClauseCtx.yield->yieldColumns->size()); - for (auto *col : retClauseCtx.yield->yieldColumns->columns()) { - if (!retClauseCtx.yield->hasAgg_ && - ExpressionUtils::hasAny(col->expr(), {Expression::Kind::kAggregate})) { - retClauseCtx.yield->hasAgg_ = true; - } - exprs.push_back(col->expr()); - } NG_RETURN_IF_ERROR(validateAliases(exprs, retClauseCtx.yield->aliasesAvailable)); NG_RETURN_IF_ERROR(validateYield(*retClauseCtx.yield)); @@ -416,6 +415,7 @@ Status MatchValidator::validateAliases( const std::unordered_map &aliasesAvailable) const { static const std::unordered_set kinds = {Expression::Kind::kLabel, Expression::Kind::kLabelAttribute, + Expression::Kind::kLabelTagProperty, // primitive props Expression::Kind::kEdgeSrc, Expression::Kind::kEdgeDst, @@ -459,6 +459,7 @@ Status MatchValidator::validateWith(const WithClause *with, } if (with->returnItems()->columns()) { for (auto *column : with->returnItems()->columns()->columns()) { + column->setExpr(ExpressionUtils::rewriteAttr2LabelTagProp(column->expr())); columns->addColumn(column->clone().release()); } } @@ -469,12 +470,13 @@ Status MatchValidator::validateWith(const WithClause *with, exprs.reserve(withClauseCtx.yield->yieldColumns->size()); for (auto *col : withClauseCtx.yield->yieldColumns->columns()) { auto labelExprs = ExpressionUtils::collectAll(col->expr(), {Expression::Kind::kLabel}); + auto aliasType = AliasType::kDefault; for (auto *labelExpr : labelExprs) { - DCHECK_EQ(labelExpr->kind(), Expression::Kind::kLabel); auto label = static_cast(labelExpr)->name(); if (!withClauseCtx.yield->aliasesAvailable.count(label)) { return Status::SemanticError("Alias `%s` not defined", label.c_str()); } + aliasType = withClauseCtx.yield->aliasesAvailable.at(label); } if (col->alias().empty()) { if (col->expr()->kind() == Expression::Kind::kLabel) { @@ -491,7 +493,7 @@ Status MatchValidator::validateWith(const WithClause *with, return Status::SemanticError("`%s': Redefined alias", col->alias().c_str()); } } else { - if (!withClauseCtx.aliasesGenerated.emplace(col->alias(), AliasType::kDefault).second) { + if (!withClauseCtx.aliasesGenerated.emplace(col->alias(), aliasType).second) { return Status::SemanticError("`%s': Redefined alias", col->alias().c_str()); } } @@ -809,25 +811,34 @@ Status MatchValidator::checkAlias( case Expression::Kind::kLabel: { auto name = static_cast(refExpr)->name(); auto res = getAliasType(aliasesAvailable, name); - if (!res.ok()) { - return res.status(); + NG_RETURN_IF_ERROR(res); + return Status::OK(); + } + case Expression::Kind::kLabelTagProperty: { + auto labelExpr = static_cast(refExpr)->label(); + auto name = static_cast(labelExpr)->prop(); + auto res = getAliasType(aliasesAvailable, name); + NG_RETURN_IF_ERROR(res); + if (res.value() != AliasType::kNode) { + return Status::SemanticError("The type of `%s' should be tag", name.c_str()); } return Status::OK(); } case Expression::Kind::kLabelAttribute: { auto name = static_cast(refExpr)->left()->name(); auto res = getAliasType(aliasesAvailable, name); - if (!res.ok()) { - return res.status(); + NG_RETURN_IF_ERROR(res); + if (res.value() == AliasType::kNode) { + return Status::SemanticError( + "To get the property of the vertex in `%s', should use the format `var.tag.prop'", + refExpr->toString().c_str()); } return Status::OK(); } case Expression::Kind::kEdgeSrc: { auto name = static_cast(refExpr)->sym(); auto res = getAliasType(aliasesAvailable, name); - if (!res.ok()) { - return res.status(); - } + NG_RETURN_IF_ERROR(res); aliasType = res.value(); switch (aliasType) { case AliasType::kNode: @@ -845,9 +856,7 @@ Status MatchValidator::checkAlias( case Expression::Kind::kEdgeDst: { auto name = static_cast(refExpr)->sym(); auto res = getAliasType(aliasesAvailable, name); - if (!res.ok()) { - return res.status(); - } + NG_RETURN_IF_ERROR(res); aliasType = res.value(); switch (aliasType) { case AliasType::kNode: @@ -865,9 +874,7 @@ Status MatchValidator::checkAlias( case Expression::Kind::kEdgeRank: { auto name = static_cast(refExpr)->sym(); auto res = getAliasType(aliasesAvailable, name); - if (!res.ok()) { - return res.status(); - } + NG_RETURN_IF_ERROR(res); aliasType = res.value(); switch (aliasType) { case AliasType::kNode: @@ -887,9 +894,7 @@ Status MatchValidator::checkAlias( case Expression::Kind::kEdgeType: { auto name = static_cast(refExpr)->sym(); auto res = getAliasType(aliasesAvailable, name); - if (!res.ok()) { - return res.status(); - } + NG_RETURN_IF_ERROR(res); aliasType = res.value(); switch (aliasType) { case AliasType::kNode: diff --git a/src/graph/validator/test/MatchValidatorTest.cpp b/src/graph/validator/test/MatchValidatorTest.cpp index 715f206f6d6..2356e2da7b4 100644 --- a/src/graph/validator/test/MatchValidatorTest.cpp +++ b/src/graph/validator/test/MatchValidatorTest.cpp @@ -34,7 +34,7 @@ TEST_F(MatchValidatorTest, SeekByTagIndex) { } // non empty properties index with extend { - std::string query = "MATCH (p:person)-[:like]->(b:book) RETURN b.name AS book;"; + std::string query = "MATCH (p:person)-[:like]->(b:book) RETURN b.book.name AS book;"; std::vector expected = {PlanNode::Kind::kProject, PlanNode::Kind::kProject, PlanNode::Kind::kAppendVertices, @@ -77,10 +77,10 @@ TEST_F(MatchValidatorTest, groupby) { "MATCH(n:person)" "RETURN id(n) AS id," "count(n) AS count," - "sum(floor(n.age)) AS sum," - "max(n.age) AS max," - "min(n.age) AS min," - "avg(distinct n.age) AS age," + "sum(floor(n.person.age)) AS sum," + "max(n.person.age) AS max," + "min(n.person.age) AS min," + "avg(distinct n.person.age) AS age," "labels(n) AS lb;"; std::vector expected = {PlanNode::Kind::kAggregate, PlanNode::Kind::kProject, @@ -94,10 +94,10 @@ TEST_F(MatchValidatorTest, groupby) { "MATCH(n:person)" "RETURN id(n) AS id," "count(*) AS count," - "sum(floor(n.age)) AS sum," - "max(n.age) AS max," - "min(n.age) AS min," - "(INT)avg(distinct n.age)+1 AS age," + "sum(floor(n.person.age)) AS sum," + "max(n.person.age) AS max," + "min(n.person.age) AS min," + "(INT)avg(distinct n.person.age)+1 AS age," "labels(n) AS lb;"; std::vector expected = {PlanNode::Kind::kProject, PlanNode::Kind::kAggregate, @@ -112,10 +112,10 @@ TEST_F(MatchValidatorTest, groupby) { "MATCH(n:person)" "RETURN id(n) AS id," "count(n) AS count," - "sum(floor(n.age)) AS sum," - "max(n.age) AS max," - "min(n.age) AS min," - "avg(distinct n.age)+1 AS age," + "sum(floor(n.person.age)) AS sum," + "max(n.person.age) AS max," + "min(n.person.age) AS min," + "avg(distinct n.person.age)+1 AS age," "labels(n) AS lb " "ORDER BY id;"; std::vector expected = {PlanNode::Kind::kDataCollect, @@ -133,10 +133,10 @@ TEST_F(MatchValidatorTest, groupby) { "MATCH(n:person)" "RETURN id(n) AS id," "count(n) AS count," - "sum(floor(n.age)) AS sum," - "max(n.age) AS max," - "min(n.age) AS min," - "avg(distinct n.age)+1 AS age," + "sum(floor(n.person.age)) AS sum," + "max(n.person.age) AS max," + "min(n.person.age) AS min," + "avg(distinct n.person.age)+1 AS age," "labels(n) AS lb " "ORDER BY id " "SKIP 10 LIMIT 20;"; @@ -156,10 +156,10 @@ TEST_F(MatchValidatorTest, groupby) { "MATCH(n:person)-[:like]->(m) " "RETURN id(n) AS id," "count(n) AS count," - "sum(floor(n.age)) AS sum," - "max(m.age) AS max," - "min(n.age) AS min," - "avg(distinct n.age) AS age," + "sum(floor(n.person.age)) AS sum," + "max(m.person.age) AS max," + "min(n.person.age) AS min," + "avg(distinct n.person.age) AS age," "labels(m) AS lb;"; std::vector expected = {PlanNode::Kind::kAggregate, PlanNode::Kind::kProject, @@ -174,10 +174,10 @@ TEST_F(MatchValidatorTest, groupby) { "MATCH(n:person)-[:like]->(m) " "RETURN id(n) AS id," "count(n) AS count," - "sum(floor(n.age)) AS sum," - "max(m.age) AS max," - "min(n.age) AS min," - "avg(distinct n.age)+1 AS age," + "sum(floor(n.person.age)) AS sum," + "max(m.person.age) AS max," + "min(n.person.age) AS min," + "avg(distinct n.person.age)+1 AS age," "labels(m) AS lb;"; std::vector expected = {PlanNode::Kind::kProject, PlanNode::Kind::kAggregate, @@ -191,13 +191,13 @@ TEST_F(MatchValidatorTest, groupby) { { std::string query = "MATCH(n:person)-[:like]->(m) " - "WHERE n.age > 35 " + "WHERE n.person.age > 35 " "RETURN id(n) AS id," "count(n) AS count," - "sum(floor(n.age)) AS sum," - "max(m.age) AS max," - "min(n.age) AS min," - "avg(distinct n.age) AS age," + "sum(floor(n.person.age)) AS sum," + "max(m.person.age) AS max," + "min(n.person.age) AS min," + "avg(distinct n.person.age) AS age," "labels(m) AS lb "; std::vector expected = {PlanNode::Kind::kAggregate, PlanNode::Kind::kFilter, @@ -211,13 +211,13 @@ TEST_F(MatchValidatorTest, groupby) { { std::string query = "MATCH(n:person)-[:like]->(m) " - "WHERE n.age > 35 " + "WHERE n.person.age > 35 " "RETURN id(n) AS id," "count(n) AS count," - "sum(floor(n.age)) AS sum," - "max(m.age) AS max," - "min(n.age) AS min," - "avg(distinct n.age) AS age," + "sum(floor(n.person.age)) AS sum," + "max(m.person.age) AS max," + "min(n.person.age) AS min," + "avg(distinct n.person.age) AS age," "labels(m) AS lb " "SKIP 10 LIMIT 20;"; std::vector expected = {PlanNode::Kind::kDataCollect, @@ -234,13 +234,13 @@ TEST_F(MatchValidatorTest, groupby) { { std::string query = "MATCH(n:person)-[:like]->(m) " - "WHERE n.age > 35 " + "WHERE n.person.age > 35 " "RETURN DISTINCT id(n) AS id," "count(n) AS count," - "sum(floor(n.age)) AS sum," - "max(m.age) AS max," - "min(n.age) AS min," - "avg(distinct n.age) AS age," + "sum(floor(n.person.age)) AS sum," + "max(m.person.age) AS max," + "min(n.person.age) AS min," + "avg(distinct n.person.age) AS age," "labels(m) AS lb;"; std::vector expected = {PlanNode::Kind::kDataCollect, PlanNode::Kind::kDedup, @@ -256,13 +256,13 @@ TEST_F(MatchValidatorTest, groupby) { { std::string query = "MATCH(n:person)-[:like]->(m) " - "WHERE n.age > 35 " + "WHERE n.person.age > 35 " "RETURN id(n) AS id," "count(n) AS count," - "sum(floor(n.age)) AS sum," - "max(m.age) AS max," - "min(n.age) AS min," - "avg(distinct n.age)+1 AS age," + "sum(floor(n.person.age)) AS sum," + "max(m.person.age) AS max," + "min(n.person.age) AS min," + "avg(distinct n.person.age)+1 AS age," "labels(m) AS lb " "SKIP 10 LIMIT 20;"; std::vector expected = {PlanNode::Kind::kDataCollect, @@ -280,13 +280,13 @@ TEST_F(MatchValidatorTest, groupby) { { std::string query = "MATCH(n:person)-[:like]->(m) " - "WHERE n.age > 35 " + "WHERE n.person.age > 35 " "RETURN DISTINCT id(n) AS id," "count(n) AS count," - "sum(floor(n.age)) AS sum," - "max(m.age) AS max," - "min(n.age) AS min," - "avg(distinct n.age)+1 AS age," + "sum(floor(n.person.age)) AS sum," + "max(m.person.age) AS max," + "min(n.person.age) AS min," + "avg(distinct n.person.age)+1 AS age," "labels(m) AS lb " "ORDER BY id " "SKIP 10 LIMIT 20;"; @@ -307,13 +307,13 @@ TEST_F(MatchValidatorTest, groupby) { { std::string query = "MATCH(n:person)-[:like]->(m) " - "WHERE n.age > 35 " + "WHERE n.person.age > 35 " "RETURN DISTINCT id(n) AS id," "count(n) AS count," - "sum(floor(n.age)) AS sum," - "max(m.age) AS max," - "min(n.age) AS min," - "avg(distinct n.age) AS age," + "sum(floor(n.person.age)) AS sum," + "max(m.person.age) AS max," + "min(n.person.age) AS min," + "avg(distinct n.person.age) AS age," "labels(m) AS lb " "ORDER BY id " "SKIP 10 LIMIT 20;"; @@ -333,13 +333,13 @@ TEST_F(MatchValidatorTest, groupby) { { std::string query = "MATCH(n:person)-[:like]->(m)-[:serve]-() " - "WHERE n.age > 35 " + "WHERE n.person.age > 35 " "RETURN DISTINCT id(n) AS id," "count(n) AS count," - "sum(floor(n.age)) AS sum," - "max(m.age) AS max," - "min(n.age) AS min," - "(INT)avg(distinct n.age)+1 AS age," + "sum(floor(n.person.age)) AS sum," + "max(m.person.age) AS max," + "min(n.person.age) AS min," + "(INT)avg(distinct n.person.age)+1 AS age," "labels(m) AS lb " "ORDER BY id " "SKIP 10 LIMIT 20;"; @@ -364,7 +364,7 @@ TEST_F(MatchValidatorTest, with) { { std::string query = "MATCH (v :person{name:\"Tim Duncan\"})-[]-(v2) " - "WITH abs(avg(v2.age)) as average_age " + "WITH abs(avg(v2.person.age)) as average_age " "RETURN average_age"; std::vector expected = {PlanNode::Kind::kProject, PlanNode::Kind::kProject, diff --git a/src/graph/validator/test/QueryValidatorTest.cpp b/src/graph/validator/test/QueryValidatorTest.cpp index fe344e6f2c8..73ad0e90f69 100644 --- a/src/graph/validator/test/QueryValidatorTest.cpp +++ b/src/graph/validator/test/QueryValidatorTest.cpp @@ -1175,7 +1175,7 @@ TEST_F(QueryValidatorTest, TestMatch) { { std::string query = "MATCH (v1:person{name: \"LeBron James\"}) -[r]-> (v2) " - "RETURN type(r) AS Type, v2.name AS Name"; + "RETURN type(r) AS Type, v2.person.name AS Name"; std::vector expected = { PK::kProject, PK::kProject, @@ -1189,7 +1189,7 @@ TEST_F(QueryValidatorTest, TestMatch) { { std::string query = "MATCH (:person{name:'Dwyane Wade'}) -[:like]-> () -[:like]-> (v3) " - "RETURN DISTINCT v3.name AS Name"; + "RETURN DISTINCT v3.person.name AS Name"; std::vector expected = { PK::kDataCollect, PK::kDedup, @@ -1207,7 +1207,7 @@ TEST_F(QueryValidatorTest, TestMatch) { std::string query = "MATCH (v1) -[r]-> (v2) " "WHERE id(v1) == \"LeBron James\"" - "RETURN type(r) AS Type, v2.name AS Name"; + "RETURN type(r) AS Type, v2.person.name AS Name"; std::vector expected = { PK::kProject, PK::kFilter, diff --git a/src/graph/visitor/DeducePropsVisitor.cpp b/src/graph/visitor/DeducePropsVisitor.cpp index 6e728407f82..ee5a8743a8a 100644 --- a/src/graph/visitor/DeducePropsVisitor.cpp +++ b/src/graph/visitor/DeducePropsVisitor.cpp @@ -138,6 +138,16 @@ void DeducePropsVisitor::visit(TagPropertyExpression *expr) { exprProps_->insertTagProp(status.value(), expr->prop()); } +void DeducePropsVisitor::visit(LabelTagPropertyExpression *expr) { + auto status = qctx_->schemaMng()->toTagID(space_, expr->sym()); + if (!status.ok()) { + status_ = std::move(status).status(); + return; + } + exprProps_->insertTagNameIds(expr->sym(), status.value()); + exprProps_->insertTagProp(status.value(), expr->prop()); +} + void DeducePropsVisitor::visit(InputPropertyExpression *expr) { exprProps_->insertInputProp(expr->prop()); } diff --git a/src/graph/visitor/DeducePropsVisitor.h b/src/graph/visitor/DeducePropsVisitor.h index a7bb0674380..b556edce78a 100644 --- a/src/graph/visitor/DeducePropsVisitor.h +++ b/src/graph/visitor/DeducePropsVisitor.h @@ -104,6 +104,7 @@ class DeducePropsVisitor : public ExprVisitorImpl { private: using ExprVisitorImpl::visit; void visit(EdgePropertyExpression* expr) override; + void visit(LabelTagPropertyExpression* expr) override; void visit(TagPropertyExpression* expr) override; void visit(InputPropertyExpression* expr) override; void visit(VariablePropertyExpression* expr) override; diff --git a/src/graph/visitor/DeduceTypeVisitor.cpp b/src/graph/visitor/DeduceTypeVisitor.cpp index 6da49e4327a..abb6e0c2539 100644 --- a/src/graph/visitor/DeduceTypeVisitor.cpp +++ b/src/graph/visitor/DeduceTypeVisitor.cpp @@ -352,6 +352,13 @@ void DeduceTypeVisitor::visit(SubscriptExpression *expr) { type_ = Value::Type::__EMPTY__; } +// in order to be consistent with the behavior in the opencypher, the schema is not checked +void DeduceTypeVisitor::visit(LabelTagPropertyExpression *expr) { + UNUSED(expr); + type_ = Value::Type::__EMPTY__; + return; +} + void DeduceTypeVisitor::visit(AttributeExpression *expr) { expr->left()->accept(this); if (!ok()) return; @@ -442,6 +449,7 @@ void DeduceTypeVisitor::visit(FunctionCallExpression *expr) { if (!ok()) return; argsTypeList.push_back(type_); } + auto funName = expr->name(); if (funName == "id" || funName == "src" || funName == "dst") { type_ = vidType_; @@ -617,6 +625,10 @@ void DeduceTypeVisitor::visit(CaseExpression *expr) { } void DeduceTypeVisitor::visit(PredicateExpression *expr) { + if (expr->name() == "exists") { + type_ = Value::Type::BOOL; + return; + } if (expr->hasFilter()) { expr->filter()->accept(this); if (!ok()) { diff --git a/src/graph/visitor/DeduceTypeVisitor.h b/src/graph/visitor/DeduceTypeVisitor.h index 9a32675ed8a..688dba6814f 100644 --- a/src/graph/visitor/DeduceTypeVisitor.h +++ b/src/graph/visitor/DeduceTypeVisitor.h @@ -63,6 +63,7 @@ class DeduceTypeVisitor final : public ExprVisitor { void visit(SetExpression *expr) override; void visit(MapExpression *expr) override; // property Expression + void visit(LabelTagPropertyExpression *expr) override; void visit(TagPropertyExpression *expr) override; void visit(EdgePropertyExpression *expr) override; void visit(InputPropertyExpression *expr) override; diff --git a/src/graph/visitor/EvaluableExprVisitor.cpp b/src/graph/visitor/EvaluableExprVisitor.cpp index db75d098dfa..54c85923dc5 100644 --- a/src/graph/visitor/EvaluableExprVisitor.cpp +++ b/src/graph/visitor/EvaluableExprVisitor.cpp @@ -40,6 +40,10 @@ void EvaluableExprVisitor::visit(EdgePropertyExpression *) { isEvaluable_ = false; } +void EvaluableExprVisitor::visit(LabelTagPropertyExpression *) { + isEvaluable_ = false; +} + void EvaluableExprVisitor::visit(InputPropertyExpression *) { isEvaluable_ = false; } diff --git a/src/graph/visitor/EvaluableExprVisitor.h b/src/graph/visitor/EvaluableExprVisitor.h index f47a681d388..7f5a8b73026 100644 --- a/src/graph/visitor/EvaluableExprVisitor.h +++ b/src/graph/visitor/EvaluableExprVisitor.h @@ -36,6 +36,8 @@ class EvaluableExprVisitor : public ExprVisitorImpl { void visit(EdgePropertyExpression *) override; + void visit(LabelTagPropertyExpression *) override; + void visit(InputPropertyExpression *) override; void visit(VariablePropertyExpression *) override; diff --git a/src/graph/visitor/ExtractFilterExprVisitor.cpp b/src/graph/visitor/ExtractFilterExprVisitor.cpp index 087109e2f3c..69073f3d1ca 100644 --- a/src/graph/visitor/ExtractFilterExprVisitor.cpp +++ b/src/graph/visitor/ExtractFilterExprVisitor.cpp @@ -60,6 +60,20 @@ void ExtractFilterExprVisitor::visit(InputPropertyExpression *) { canBePushed_ = false; } +void ExtractFilterExprVisitor::visit(LabelTagPropertyExpression *) { + switch (pushType_) { + case PushType::kGetNeighbors: + canBePushed_ = false; + break; + case PushType::kGetVertices: + canBePushed_ = true; + break; + case PushType::kGetEdges: + canBePushed_ = false; + break; + } +} + void ExtractFilterExprVisitor::visit(VariablePropertyExpression *) { canBePushed_ = false; } diff --git a/src/graph/visitor/ExtractFilterExprVisitor.h b/src/graph/visitor/ExtractFilterExprVisitor.h index d23233714e6..f4c6fd98c43 100644 --- a/src/graph/visitor/ExtractFilterExprVisitor.h +++ b/src/graph/visitor/ExtractFilterExprVisitor.h @@ -51,6 +51,7 @@ class ExtractFilterExprVisitor final : public ExprVisitorImpl { void visit(VariableExpression *) override; void visit(VersionedVariableExpression *) override; void visit(TagPropertyExpression *) override; + void visit(LabelTagPropertyExpression *) override; void visit(EdgePropertyExpression *) override; void visit(InputPropertyExpression *) override; void visit(VariablePropertyExpression *) override; diff --git a/src/graph/visitor/ExtractPropExprVisitor.cpp b/src/graph/visitor/ExtractPropExprVisitor.cpp index 213ba07e5eb..5b2cfab849e 100644 --- a/src/graph/visitor/ExtractPropExprVisitor.cpp +++ b/src/graph/visitor/ExtractPropExprVisitor.cpp @@ -59,6 +59,10 @@ void ExtractPropExprVisitor::visit(LabelAttributeExpression* expr) { reportError(expr); } +void ExtractPropExprVisitor::visit(LabelTagPropertyExpression* expr) { + reportError(expr); +} + void ExtractPropExprVisitor::visit(VersionedVariableExpression* expr) { reportError(expr); } diff --git a/src/graph/visitor/ExtractPropExprVisitor.h b/src/graph/visitor/ExtractPropExprVisitor.h index 63e3c7bbc2c..87095bd8db6 100644 --- a/src/graph/visitor/ExtractPropExprVisitor.h +++ b/src/graph/visitor/ExtractPropExprVisitor.h @@ -45,6 +45,7 @@ class ExtractPropExprVisitor final : public ExprVisitorImpl { void visit(VariableExpression *) override; void visit(VersionedVariableExpression *) override; // property Expression + void visit(LabelTagPropertyExpression *) override; void visit(TagPropertyExpression *) override; void visit(EdgePropertyExpression *) override; void visit(InputPropertyExpression *) override; diff --git a/src/graph/visitor/FindVisitor.cpp b/src/graph/visitor/FindVisitor.cpp index ad9b26bca3e..2fbaa475085 100644 --- a/src/graph/visitor/FindVisitor.cpp +++ b/src/graph/visitor/FindVisitor.cpp @@ -201,6 +201,12 @@ void FindVisitor::visit(VertexExpression* expr) { findInCurrentExpr(expr); } +void FindVisitor::visit(LabelTagPropertyExpression* expr) { + findInCurrentExpr(expr); + if (!needFindAll_ && !foundExprs_.empty()) return; + expr->label()->accept(this); +} + void FindVisitor::visit(EdgeExpression* expr) { findInCurrentExpr(expr); } diff --git a/src/graph/visitor/FindVisitor.h b/src/graph/visitor/FindVisitor.h index d09717b38c9..5a8ededb97d 100644 --- a/src/graph/visitor/FindVisitor.h +++ b/src/graph/visitor/FindVisitor.h @@ -55,6 +55,7 @@ class FindVisitor final : public ExprVisitorImpl { void visit(ConstantExpression* expr) override; void visit(EdgePropertyExpression* expr) override; void visit(TagPropertyExpression* expr) override; + void visit(LabelTagPropertyExpression* expr) override; void visit(InputPropertyExpression* expr) override; void visit(VariablePropertyExpression* expr) override; void visit(SourcePropertyExpression* expr) override; diff --git a/src/graph/visitor/FoldConstantExprVisitor.cpp b/src/graph/visitor/FoldConstantExprVisitor.cpp index 0e437749299..fbef39e32bb 100644 --- a/src/graph/visitor/FoldConstantExprVisitor.cpp +++ b/src/graph/visitor/FoldConstantExprVisitor.cpp @@ -44,6 +44,11 @@ void FoldConstantExprVisitor::visit(LabelExpression *expr) { canBeFolded_ = false; } +void FoldConstantExprVisitor::visit(LabelTagPropertyExpression *expr) { + UNUSED(expr); + canBeFolded_ = false; +} + void FoldConstantExprVisitor::visit(LabelAttributeExpression *expr) { UNUSED(expr); canBeFolded_ = false; diff --git a/src/graph/visitor/FoldConstantExprVisitor.h b/src/graph/visitor/FoldConstantExprVisitor.h index 8caf1961c65..a5ab4c31fe4 100644 --- a/src/graph/visitor/FoldConstantExprVisitor.h +++ b/src/graph/visitor/FoldConstantExprVisitor.h @@ -7,7 +7,6 @@ #define GRAPH_VISITOR_FOLDCONSTANTEXPRVISITOR_H_ #include "common/expression/ExprVisitor.h" -// #include "common/base/Status.h" namespace nebula { namespace graph { @@ -55,6 +54,7 @@ class FoldConstantExprVisitor final : public ExprVisitor { void visit(SetExpression *expr) override; void visit(MapExpression *expr) override; // property Expression + void visit(LabelTagPropertyExpression *expr) override; void visit(TagPropertyExpression *expr) override; void visit(EdgePropertyExpression *expr) override; void visit(InputPropertyExpression *expr) override; diff --git a/src/graph/visitor/RewriteSymExprVisitor.cpp b/src/graph/visitor/RewriteSymExprVisitor.cpp index 192dd966fcb..214aaf621b0 100644 --- a/src/graph/visitor/RewriteSymExprVisitor.cpp +++ b/src/graph/visitor/RewriteSymExprVisitor.cpp @@ -152,6 +152,11 @@ void RewriteSymExprVisitor::visit(TagPropertyExpression *expr) { hasWrongType_ = true; } +void RewriteSymExprVisitor::visit(LabelTagPropertyExpression *expr) { + UNUSED(expr); + hasWrongType_ = true; +} + void RewriteSymExprVisitor::visit(EdgePropertyExpression *expr) { UNUSED(expr); if (!isEdge_) { diff --git a/src/graph/visitor/RewriteSymExprVisitor.h b/src/graph/visitor/RewriteSymExprVisitor.h index cdd6e3a29e2..3ff63445072 100644 --- a/src/graph/visitor/RewriteSymExprVisitor.h +++ b/src/graph/visitor/RewriteSymExprVisitor.h @@ -51,6 +51,7 @@ class RewriteSymExprVisitor final : public ExprVisitor { void visit(SetExpression *expr) override; void visit(MapExpression *expr) override; // property Expression + void visit(LabelTagPropertyExpression *expr) override; void visit(TagPropertyExpression *expr) override; void visit(EdgePropertyExpression *expr) override; void visit(InputPropertyExpression *expr) override; diff --git a/src/graph/visitor/RewriteVisitor.h b/src/graph/visitor/RewriteVisitor.h index dc5c4a9cb25..365908ed288 100644 --- a/src/graph/visitor/RewriteVisitor.h +++ b/src/graph/visitor/RewriteVisitor.h @@ -7,7 +7,6 @@ #define GRAPH_VISITOR_REWRITEVISITOR_H_ #include -#include #include "graph/visitor/ExprVisitorImpl.h" @@ -73,6 +72,7 @@ class RewriteVisitor final : public ExprVisitorImpl { void visit(LabelExpression*) override {} void visit(UUIDExpression*) override {} void visit(LabelAttributeExpression*) override {} + void visit(LabelTagPropertyExpression*) override {} void visit(VariableExpression*) override {} void visit(VersionedVariableExpression*) override {} void visit(TagPropertyExpression*) override {} diff --git a/src/graph/visitor/VidExtractVisitor.cpp b/src/graph/visitor/VidExtractVisitor.cpp index 82cc0e1dff4..75dee22a026 100644 --- a/src/graph/visitor/VidExtractVisitor.cpp +++ b/src/graph/visitor/VidExtractVisitor.cpp @@ -351,6 +351,11 @@ void VidExtractVisitor::visit(MapExpression *expr) { } // property Expression +void VidExtractVisitor::visit(LabelTagPropertyExpression *expr) { + UNUSED(expr); + vidPattern_ = VidPattern{}; +} + void VidExtractVisitor::visit(TagPropertyExpression *expr) { UNUSED(expr); vidPattern_ = VidPattern{}; diff --git a/src/graph/visitor/VidExtractVisitor.h b/src/graph/visitor/VidExtractVisitor.h index c31a7d965ec..82df3f2eb0e 100644 --- a/src/graph/visitor/VidExtractVisitor.h +++ b/src/graph/visitor/VidExtractVisitor.h @@ -77,6 +77,7 @@ class VidExtractVisitor final : public ExprVisitor { void visit(SetExpression *expr) override; void visit(MapExpression *expr) override; // property Expression + void visit(LabelTagPropertyExpression *expr) override; void visit(TagPropertyExpression *expr) override; void visit(EdgePropertyExpression *expr) override; void visit(InputPropertyExpression *expr) override; diff --git a/src/storage/ExprVisitorBase.cpp b/src/storage/ExprVisitorBase.cpp index df2bd2a67dc..5927745b3ea 100644 --- a/src/storage/ExprVisitorBase.cpp +++ b/src/storage/ExprVisitorBase.cpp @@ -105,6 +105,9 @@ void ExprVisitorBase::visit(EdgeRankExpression *expr) { void ExprVisitorBase::visit(EdgeDstIdExpression *expr) { UNUSED(expr); } +void ExprVisitorBase::visit(LabelTagPropertyExpression *expr) { + UNUSED(expr); +} // vertex/edge expression void ExprVisitorBase::visit(VertexExpression *expr) { UNUSED(expr); diff --git a/src/storage/ExprVisitorBase.h b/src/storage/ExprVisitorBase.h index 015f02d5aca..516f89e4ed1 100644 --- a/src/storage/ExprVisitorBase.h +++ b/src/storage/ExprVisitorBase.h @@ -33,6 +33,7 @@ class ExprVisitorBase : public ::nebula::ExprVisitor { void visit(SetExpression *expr) override; void visit(MapExpression *expr) override; // property Expression + void visit(LabelTagPropertyExpression *expr) override; void visit(TagPropertyExpression *expr) override; void visit(EdgePropertyExpression *expr) override; void visit(InputPropertyExpression *expr) override; diff --git a/src/storage/exec/IndexSelectionNode.h b/src/storage/exec/IndexSelectionNode.h index c41a09b512e..3cf9a30e2d9 100644 --- a/src/storage/exec/IndexSelectionNode.h +++ b/src/storage/exec/IndexSelectionNode.h @@ -140,6 +140,9 @@ class SelectionExprVisitor : public ExprVisitorBase { void visit(EdgePropertyExpression *expr) override { requiredColumns_.insert(expr->prop()); } + void visit(LabelTagPropertyExpression *expr) override { + requiredColumns_.insert(expr->prop()); + } const Set &getRequiredColumns() { return requiredColumns_; } diff --git a/src/storage/query/QueryBaseProcessor-inl.h b/src/storage/query/QueryBaseProcessor-inl.h index 1c2c1594d39..6753f8f898c 100644 --- a/src/storage/query/QueryBaseProcessor-inl.h +++ b/src/storage/query/QueryBaseProcessor-inl.h @@ -583,6 +583,7 @@ nebula::cpp2::ErrorCode QueryBaseProcessor::checkExp(const Expression case Expression::Kind::kInputProperty: case Expression::Kind::kSubscript: case Expression::Kind::kAttribute: + case Expression::Kind::kLabelTagProperty: case Expression::Kind::kLabelAttribute: case Expression::Kind::kVertex: case Expression::Kind::kEdge: diff --git a/tests/tck/features/aggregate/Agg.feature b/tests/tck/features/aggregate/Agg.feature index 0e1f77c5669..9b51c6c67c0 100644 --- a/tests/tck/features/aggregate/Agg.feature +++ b/tests/tck/features/aggregate/Agg.feature @@ -426,7 +426,7 @@ Feature: Basic Aggregate and GroupBy When executing query: """ MATCH (v:player)-[:like]-(m:player) - WITH m.age AS age, count(m.age) AS count + WITH m.player.age AS age, count(m.player.age) AS count RETURN age, count ORDER BY age, count """ @@ -459,8 +459,8 @@ Feature: Basic Aggregate and GroupBy """ MATCH (v:player{name:"Tim Duncan"})-[:like]->(m) RETURN - m.name as dst, - (INT)(sum(m.age)/count(m.age))+avg(distinct m.age+1)+1 AS statistics + m.player.name as dst, + (INT)(sum(m.player.age)/count(m.player.age))+avg(distinct m.player.age+1)+1 AS statistics """ Then the result should be, in any order, with relax comparison: | dst | statistics | @@ -469,7 +469,7 @@ Feature: Basic Aggregate and GroupBy When executing query: """ MATCH (v:player {name:"noexist"})-[:like]-(m:player) - WITH m.age AS age, count(m.age) AS count + WITH m.player.age AS age, count(m.player.age) AS count RETURN age, count ORDER BY age, count """ @@ -478,15 +478,15 @@ Feature: Basic Aggregate and GroupBy When executing query: """ MATCH (v:player {name:"noexist"})-[:like]-(m:player) - RETURN count(m.age) AS count, - sum(m.age) AS sum, - avg(m.age) AS avg, - min(m.age) AS min, - max(m.age) AS max, - std(m.age) AS std, - bit_and(m.age) AS b1, - bit_or(m.age) AS b2, - bit_xor(m.age) AS b3 + RETURN count(m.player.age) AS count, + sum(m.player.age) AS sum, + avg(m.player.age) AS avg, + min(m.player.age) AS min, + max(m.player.age) AS max, + std(m.player.age) AS std, + bit_and(m.player.age) AS b1, + bit_or(m.player.age) AS b2, + bit_xor(m.player.age) AS b3 """ Then the result should be, in order, with relax comparison: | count | sum | avg | min | max | std | b1 | b2 | b3 | @@ -771,26 +771,26 @@ Feature: Basic Aggregate and GroupBy When executing query: """ MATCH (v:player) - WHERE avg(v.age) > 1 - RETURN v.age + WHERE avg(v.player.age) > 1 + RETURN v.player.age """ - Then a SyntaxError should be raised at runtime: Invalid use of aggregating function in this context. near `WHERE avg(v.age) > 1' + Then a SyntaxError should be raised at runtime: Invalid use of aggregating function in this context. near `WHERE avg(v.player.age) > 1' When executing query: """ MATCH (v:player) WITH v - WHERE avg(v.age) > 1 - RETURN v.age + WHERE avg(v.player.age) > 1 + RETURN v.player.age """ - Then a SyntaxError should be raised at runtime: Invalid use of aggregating function in this context. near `WHERE avg(v.age) > 1' + Then a SyntaxError should be raised at runtime: Invalid use of aggregating function in this context. near `WHERE avg(v.player.age) > 1' When executing query: """ MATCH (v:player) WITH DISTINCT v - WHERE avg(v.age) > 1 - RETURN v.age + WHERE avg(v.player.age) > 1 + RETURN v.player.age """ - Then a SyntaxError should be raised at runtime: Invalid use of aggregating function in this context. near `WHERE avg(v.age) > 1' + Then a SyntaxError should be raised at runtime: Invalid use of aggregating function in this context. near `WHERE avg(v.player.age) > 1' # When executing query: # """ diff --git a/tests/tck/features/bugfix/TruncatedStringIndex.feature b/tests/tck/features/bugfix/TruncatedStringIndex.feature index 00b4af86988..f3658ea0db9 100644 --- a/tests/tck/features/bugfix/TruncatedStringIndex.feature +++ b/tests/tck/features/bugfix/TruncatedStringIndex.feature @@ -37,13 +37,13 @@ Feature: Truncated string index | person.name | When executing query: """ - match (v:person) where v.name == "abc" return v; + match (v:person) where v.person.name == "abc" return v; """ Then the result should be, in any order, with relax comparison: | v | When executing query: """ - match (v:person) where v.name >= "abc" return v; + match (v:person) where v.person.name >= "abc" return v; """ Then the result should be, in any order, with relax comparison: | v | @@ -58,7 +58,7 @@ Feature: Truncated string index | ("1" :person{name: "abc1"}) | When executing query: """ - match (v:person) where v.name>"abc" return v; + match (v:person) where v.person.name>"abc" return v; """ Then the result should be, in any order, with relax comparison: | v | @@ -66,7 +66,7 @@ Feature: Truncated string index | ("2" :person{name: "abc2"}) | When executing query: """ - match (v:person) where v.name<="abc2" return v; + match (v:person) where v.person.name<="abc2" return v; """ Then the result should be, in any order, with relax comparison: | v | diff --git a/tests/tck/features/expression/Attribute.feature b/tests/tck/features/expression/Attribute.feature index eb88b295f3f..9ea378b41e5 100644 --- a/tests/tck/features/expression/Attribute.feature +++ b/tests/tck/features/expression/Attribute.feature @@ -65,18 +65,18 @@ Feature: Attribute | UNKNOWN_PROP | When executing query: """ - MATCH (v) WHERE id(v) == 'Tim Duncan' RETURN v.name + MATCH (v) WHERE id(v) == 'Tim Duncan' RETURN v.player.name """ Then the result should be, in any order: - | v.name | - | "Tim Duncan" | + | v.player.name | + | "Tim Duncan" | When executing query: """ - MATCH (v) WHERE id(v) == 'Tim Duncan' RETURN v.Name + MATCH (v) WHERE id(v) == 'Tim Duncan' RETURN v.player.Name """ Then the result should be, in any order: - | v.Name | - | UNKNOWN_PROP | + | v.player.Name | + | NULL | When executing query: """ MATCH (v)-[e:like]->() WHERE id(v) == 'Tim Duncan' RETURN e.likeness @@ -125,11 +125,11 @@ Feature: Attribute | UNKNOWN_PROP | When executing query: """ - MATCH (v) WHERE id(v) == 'Tim Duncan' RETURN v.not_exists_attr + MATCH (v) WHERE id(v) == 'Tim Duncan' RETURN v.player.not_exists_attr """ Then the result should be, in any order: - | v.not_exists_attr | - | UNKNOWN_PROP | + | v.player.not_exists_attr | + | NULL | When executing query: """ MATCH (v)-[e:like]->() WHERE id(v) == 'Tim Duncan' RETURN e.not_exists_attr @@ -151,4 +151,11 @@ Feature: Attribute """ Then the result should be, in any order: | v.name.not_exists_attr | - | BAD_TYPE | + | NULL | + When executing query: + """ + MATCH (v) WHERE id(v) == 'Tim Duncan' RETURN v.player.name.test + """ + Then the result should be, in any order: + | v.player.name.test | + | BAD_TYPE | diff --git a/tests/tck/features/expression/Case.feature b/tests/tck/features/expression/Case.feature index 5bbcddb56aa..65441a49509 100644 --- a/tests/tck/features/expression/Case.feature +++ b/tests/tck/features/expression/Case.feature @@ -149,18 +149,18 @@ Feature: Case Expression Scenario: use case in MATCH When executing query: """ - MATCH (v:player) WHERE CASE v.age > 45 WHEN false THEN false ELSE true END - RETURN v.name, v.age + MATCH (v:player) WHERE CASE v.player.age > 45 WHEN false THEN false ELSE true END + RETURN v.player.name, v.player.age """ Then the result should be, in any order: - | v.name | v.age | - | "Shaquille O'Neal" | 47 | - | "Grant Hill" | 46 | + | v.player.name | v.player.age | + | "Shaquille O'Neal" | 47 | + | "Grant Hill" | 46 | When executing query: """ MATCH (v:player) - WHERE v.age > 43 - RETURN CASE WHEN v.age > 46 THEN v.name WHEN v.age > 45 THEN v.age ELSE "nothing" END AS r + WHERE v.player.age > 43 + RETURN CASE WHEN v.player.age > 46 THEN v.player.name WHEN v.player.age > 45 THEN v.player.age ELSE "nothing" END AS r """ Then the result should be, in any order: | r | diff --git a/tests/tck/features/expression/FunctionCall.feature b/tests/tck/features/expression/FunctionCall.feature index 228a65496e9..32e2e11a798 100644 --- a/tests/tck/features/expression/FunctionCall.feature +++ b/tests/tck/features/expression/FunctionCall.feature @@ -59,21 +59,21 @@ Feature: Function Call Expression When executing query: """ MATCH (a:player)-[b:serve]-(c:team{name: "Lakers"}) - WHERE a.age > 45 - RETURN concat(a.name,c.name) + WHERE a.player.age > 45 + RETURN concat(a.player.name, c.team.name) """ Then the result should be, in any order: - | concat(a.name,c.name) | - | "Shaquille O'NealLakers" | + | concat(a.player.name,c.team.name) | + | "Shaquille O'NealLakers" | When executing query: """ MATCH (a:player)-[b:serve]-(c:team{name: "Lakers"}) - WHERE a.age > 45 - RETURN concat(a.name, "hello") + WHERE a.player.age > 45 + RETURN concat(a.player.name, "hello") """ Then the result should be, in any order: - | concat(a.name,"hello") | - | "Shaquille O'Nealhello" | + | concat(a.player.name,"hello") | + | "Shaquille O'Nealhello" | Scenario: concat_ws When executing query: @@ -87,8 +87,8 @@ Feature: Function Call Expression When executing query: """ MATCH (a:player)-[b:serve]-(c:team{name: "Lakers"}) - WHERE a.age > 45 - RETURN concat_ws("@",a.name, "hello", b.likeness, c.name) as result + WHERE a.player.age > 45 + RETURN concat_ws("@",a.player.name, "hello", b.likeness, c.team.name) as result """ Then the result should be, in any order: | result | @@ -96,8 +96,8 @@ Feature: Function Call Expression When executing query: """ MATCH (a:player)-[b:serve]-(c:team{name: "Lakers"}) - WHERE a.age > 45 - RETURN concat_ws("@",a.name, NULL, "hello", b.likeness, c.name) as result + WHERE a.player.age > 45 + RETURN concat_ws("@",a.player.name, NULL, "hello", b.likeness, c.team.name) as result """ Then the result should be, in any order: | result | @@ -105,8 +105,8 @@ Feature: Function Call Expression When executing query: """ MATCH (a:player)-[b:serve]-(c:team{name: "Lakers"}) - WHERE a.age > 45 - RETURN concat_ws(1,a.name, NULL, "hello", b.likeness, c.name) as result + WHERE a.player.age > 45 + RETURN concat_ws(1,a.player.name, NULL, "hello", b.likeness, c.team.name) as result """ Then the result should be, in any order: | result | @@ -114,8 +114,8 @@ Feature: Function Call Expression When executing query: """ MATCH (a:player)-[b:serve]-(c:team{name: "Lakers"}) - WHERE a.age > 45 - RETURN concat_ws(NULL ,a.name, NULL, "hello", b.likeness, c.name) as result + WHERE a.player.age > 45 + RETURN concat_ws(NULL ,a.player.name, NULL, "hello", b.likeness, c.team.name) as result """ Then the result should be, in any order: | result | diff --git a/tests/tck/features/expression/In.feature b/tests/tck/features/expression/In.feature index 6ff153e494b..764d9540946 100644 --- a/tests/tck/features/expression/In.feature +++ b/tests/tck/features/expression/In.feature @@ -139,18 +139,18 @@ Feature: In Expression When executing query: """ MATCH (v:player) - WHERE "Parker" IN split(v.name, " ") - RETURN v.name + WHERE "Parker" IN split(v.player.name, " ") + RETURN v.player.name """ Then the result should be, in any order: - | v.name | + | v.player.name | | "Tony Parker" | When executing query: """ MATCH (v:player) - WHERE "ing" IN [n IN split(v.name, "M") WHERE true] - RETURN v.name + WHERE "ing" IN [n IN split(v.player.name, "M") WHERE true] + RETURN v.player.name """ Then the result should be, in any order: - | v.name | - | "Yao Ming" | + | v.player.name | + | "Yao Ming" | diff --git a/tests/tck/features/expression/Predicate.feature b/tests/tck/features/expression/Predicate.feature index a4a7e881104..ed1dbcb3880 100644 --- a/tests/tck/features/expression/Predicate.feature +++ b/tests/tck/features/expression/Predicate.feature @@ -71,7 +71,7 @@ Feature: Predicate When executing query: """ MATCH(n:player) WHERE EXISTS(n['name']) - RETURN n.name AS name ORDER BY name LIMIT 10 + RETURN n.player.name AS name ORDER BY name LIMIT 10 """ Then the result should be, in order: | name | @@ -138,7 +138,7 @@ Feature: Predicate When executing query: """ MATCH(n:player) WHERE EXISTS("abc") - RETURN n.name AS name ORDER BY name LIMIT 10 + RETURN n.player.name AS name ORDER BY name LIMIT 10 """ Then a SyntaxError should be raised at runtime: The exists only accept LabelAttribute, Attribute and Subscript Then drop the used space @@ -147,7 +147,7 @@ Feature: Predicate Given a graph with space named "nba" When executing query: """ - MATCH (v:player) WHERE not exists(v.name) RETURN id(v) + MATCH (v:player) WHERE not exists(v.player.name) RETURN id(v) """ Then the result should be, in any order: | id(v) | diff --git a/tests/tck/features/expression/Regex.feature b/tests/tck/features/expression/Regex.feature index 8489f4e7bb7..138fe2d860a 100644 --- a/tests/tck/features/expression/Regex.feature +++ b/tests/tck/features/expression/Regex.feature @@ -104,8 +104,8 @@ Feature: Regular Expression When executing query: """ MATCH (v:player) - WHERE v.name =~ "T\\w+\\s?.*" - RETURN v.name AS name + WHERE v.player.name =~ "T\\w+\\s?.*" + RETURN v.player.name AS name """ Then the result should be, in any order: | name | @@ -116,9 +116,9 @@ Feature: Regular Expression When executing query: """ MATCH (v:player) - WHERE v.name STARTS WITH "Tony" - RETURN v.name, v.name =~ "T\\w+\\s?.*" AS b + WHERE v.player.name STARTS WITH "Tony" + RETURN v.player.name, v.player.name =~ "T\\w+\\s?.*" AS b """ Then the result should be, in any order: - | v.name | b | + | v.player.name | b | | "Tony Parker" | true | diff --git a/tests/tck/features/expression/RelationalExpr.feature b/tests/tck/features/expression/RelationalExpr.feature index 2215e01c414..16662f0b5b8 100644 --- a/tests/tck/features/expression/RelationalExpr.feature +++ b/tests/tck/features/expression/RelationalExpr.feature @@ -117,10 +117,10 @@ Feature: RelationalExpression When executing query: """ MATCH p = (n:player)<-[e:like]-(m) - WHERE n.age >= 33 OR n.start_year <= 2010.0 - OR e.likeness <> 90 OR n.nonExistTag <> null - OR e.likeness >= "12" OR n.age <= true - RETURN DISTINCT m.name AS player, m.age AS age + WHERE n.player.age >= 33 OR n.player.start_year <= 2010.0 + OR e.likeness <> 90 OR n.player.nonExistTag <> null + OR e.likeness >= "12" OR n.player.age <= true + RETURN DISTINCT m.player.name AS player, m.player.age AS age ORDER BY player, age """ Then the result should be, in any order, with relax comparison: @@ -164,10 +164,10 @@ Feature: RelationalExpression When executing query: """ MATCH p = (n:player)<-[e:like]-(m) - WHERE n.age >= 33 OR n.name <= "2010.0" - AND e.likeness <> 90 OR n.nonExistTag <> null - OR e.likeness >= "12" OR n.age <= true - RETURN DISTINCT m.name AS player, m.age AS age + WHERE n.player.age >= 33 OR n.player.name <= "2010.0" + AND e.likeness <> 90 OR n.player.nonExistTag <> null + OR e.likeness >= "12" OR n.player.age <= true + RETURN DISTINCT m.player.name AS player, m.player.age AS age ORDER BY player, age """ Then the result should be, in any order, with relax comparison: @@ -207,10 +207,10 @@ Feature: RelationalExpression When executing query: """ MATCH p = (n:player)<-[e:like]-(m) - WHERE n.age >= 33 AND n.name <> "2010.0" - AND e.likeness == 90 AND n.nonExistTag <> null + WHERE n.player.age >= 33 AND n.player.name <> "2010.0" + AND e.likeness == 90 AND n.player.nonExistTag <> null AND e.likeness >= "12" - RETURN n.name AS player, n.age AS age + RETURN n.player.name AS player, n.player.age AS age """ Then the result should be, in any order, with relax comparison: | player | age | @@ -218,7 +218,7 @@ Feature: RelationalExpression Scenario: Transform Relational expr in MATCH clause When profiling query: """ - MATCH (v:player) WHERE v.age - 5 >= 40 RETURN v + MATCH (v:player) WHERE v.player.age - 5 >= 40 RETURN v """ Then the result should be, in any order: | v | diff --git a/tests/tck/features/expression/UnaryExpr.feature b/tests/tck/features/expression/UnaryExpr.feature index 591e127e652..0a683863978 100644 --- a/tests/tck/features/expression/UnaryExpr.feature +++ b/tests/tck/features/expression/UnaryExpr.feature @@ -40,7 +40,7 @@ Feature: UnaryExpression When executing query: """ MATCH (v:player) - WHERE v.name IS NULL AND v.age < 0 + WHERE v.player.name IS NULL AND v.player.age < 0 RETURN v """ Then the result should be, in any order, with relax comparison: @@ -52,7 +52,7 @@ Feature: UnaryExpression When executing query: """ MATCH (v:player) - WHERE v.name IS NOT NULL AND v.age > 34 + WHERE v.player.name IS NOT NULL AND v.player.age > 34 RETURN v """ Then the result should be, in any order, with relax comparison: @@ -79,7 +79,7 @@ Feature: UnaryExpression Scenario: Unary reduce When profiling query: """ - MATCH (v:player) WHERE !!(v.age>=40) + MATCH (v:player) WHERE !!(v.player.age>=40) RETURN v """ Then the result should be, in any order: diff --git a/tests/tck/features/geo/GeoBase.feature b/tests/tck/features/geo/GeoBase.feature index a0a24e2203d..d40c7b96389 100644 --- a/tests/tck/features/geo/GeoBase.feature +++ b/tests/tck/features/geo/GeoBase.feature @@ -324,10 +324,10 @@ Feature: Geo base # Match with geo index When executing query: """ - MATCH (v:any_shape) RETURN ST_ASText(v.geo); + MATCH (v:any_shape) RETURN ST_ASText(v.any_shape.geo); """ Then the result should be, in any order: - | ST_ASText(v.geo) | + | ST_ASText(v.any_shape.geo) | | "POINT(3 8)" | | "LINESTRING(3 8, 4.7 73.23)" | | "POLYGON((0 1, 1 2, 2 3, 0 1))" | @@ -482,10 +482,10 @@ Feature: Geo base # Match with geo predicate When executing query: """ - MATCH (v:any_shape) WHERE ST_Intersects(v.geo, ST_GeogFromText('POINT(3 8)')) RETURN ST_ASText(v.geo); + MATCH (v:any_shape) WHERE ST_Intersects(v.any_shape.geo, ST_GeogFromText('POINT(3 8)')) RETURN ST_ASText(v.any_shape.geo); """ Then the result should be, in any order: - | ST_ASText(v.geo) | + | ST_ASText(v.any_shape.geo) | | "POINT(3 8)" | | "LINESTRING(3 8, 4.7 73.23)" | # ST_Distance diff --git a/tests/tck/features/match/Base.IntVid.feature b/tests/tck/features/match/Base.IntVid.feature index 0808dc173bc..dad37208f31 100644 --- a/tests/tck/features/match/Base.IntVid.feature +++ b/tests/tck/features/match/Base.IntVid.feature @@ -16,14 +16,14 @@ Feature: Basic match | ("Yao Ming") | When executing query: """ - MATCH (v:player) WHERE v.name == "Yao Ming" RETURN v.age AS Age + MATCH (v:player) WHERE v.player.name == "Yao Ming" RETURN v.player.age AS Age """ Then the result should be, in any order: | Age | | 38 | When executing query: """ - MATCH (v:player {age: 29}) return v.name AS Name + MATCH (v:player {age: 29}) return v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -33,7 +33,7 @@ Feature: Basic match | 'Dejounte Murray' | When executing query: """ - MATCH (v:player {age: 29}) WHERE v.name STARTS WITH "J" return v.name AS Name + MATCH (v:player {age: 29}) WHERE v.player.name STARTS WITH "J" return v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -41,7 +41,7 @@ Feature: Basic match | 'Jonathon Simmons' | When executing query: """ - MATCH (v:player) WHERE v.age >= 38 AND v.age < 45 return v.name AS Name, v.age AS Age + MATCH (v:player) WHERE v.player.age >= 38 AND v.player.age < 45 return v.player.name AS Name, v.player.age AS Age """ Then the result should be, in any order: | Name | Age | @@ -57,19 +57,44 @@ Feature: Basic match | 'Tracy McGrady' | 39 | When executing query: """ - MATCH (v:player) where v.age > 9223372036854775807+1 return v + MATCH (v:player) where v.player.age > 9223372036854775807+1 return v """ Then a SemanticError should be raised at runtime: result of (9223372036854775807+1) cannot be represented as an integer When executing query: """ - MATCH (v:player) where v.age > -9223372036854775808-1 return v + MATCH (v:player) where v.player.age > -9223372036854775808-1 return v """ Then a SemanticError should be raised at runtime: result of (-9223372036854775808-1) cannot be represented as an integer - Scenario: Une step + Scenario: One step When executing query: """ - MATCH (v1:player{name: "LeBron James"}) -[r]-> (v2) RETURN type(r) AS Type, v2.name AS Name + MATCH (v1:player{name: "LeBron James"}) -[r]-> (v2) + RETURN type(r) AS Type, CASE WHEN v2.tea.name IS NOT NULL THEN v2.tea.name WHEN v2.playe.name IS NOT NULL THEN v2.playe.name ELSE "abc" END AS Name + """ + Then the result should be, in any order: + | Type | Name | + | "like" | "abc" | + | "serve" | "abc" | + | "serve" | "abc" | + | "serve" | "abc" | + | "serve" | "abc" | + When executing query: + """ + MATCH (v1:player{name: "LeBron James"}) -[r]-> (v2) + RETURN type(r) AS Type, CASE WHEN v2.tea.name IS NOT NULL THEN v2.tea.name WHEN v2.playe.name IS NOT NULL THEN v2.playe.name END AS Name + """ + Then the result should be, in any order: + | Type | Name | + | "like" | NULL | + | "serve" | NULL | + | "serve" | NULL | + | "serve" | NULL | + | "serve" | NULL | + When executing query: + """ + MATCH (v1:player{name: "LeBron James"}) -[r]-> (v2) + RETURN type(r) AS Type, CASE WHEN v2.team.name IS NOT NULL THEN v2.team.name WHEN v2.player.name IS NOT NULL THEN v2.player.name END AS Name """ Then the result should be, in any order: | Type | Name | @@ -80,7 +105,8 @@ Feature: Basic match | "serve" | "Cavaliers" | When executing query: """ - MATCH (v1:player{name: "LeBron James"}) -[r:serve|:like]-> (v2) RETURN type(r) AS Type, v2.name AS Name + MATCH (v1:player{name: "LeBron James"}) -[r:serve|:like]-> (v2) + RETURN type(r) AS Type, CASE WHEN v2.team.name IS NOT NULL THEN v2.team.name WHEN v2.player.name IS NOT NULL THEN v2.player.name END AS Name """ Then the result should be, in any order: | Type | Name | @@ -92,7 +118,7 @@ Feature: Basic match When executing query: """ MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2) - RETURN type(r) AS Type, v2.name AS Name + RETURN type(r) AS Type, v2.team.name AS Name """ Then the result should be, in any order: | Type | Name | @@ -103,7 +129,7 @@ Feature: Basic match When executing query: """ MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2 {name: "Cavaliers"}) - RETURN type(r) AS Type, v2.name AS Name + RETURN type(r) AS Type, v2.team.name AS Name """ Then the result should be, in any order: | Type | Name | @@ -121,7 +147,7 @@ Feature: Basic match When executing query: """ MATCH (v1:player{name: "Danny Green"}) -[:like]-> (v2) - RETURN v1.name AS Name, v2.name AS Friend + RETURN v1.player.name AS Name, v2.player.name AS Friend """ Then the result should be, in any order: | Name | Friend | @@ -131,7 +157,7 @@ Feature: Basic match When executing query: """ MATCH (v1:player{name: "Danny Green"}) <-[:like]- (v2) - RETURN v1.name AS Name, v2.name AS Friend + RETURN v1.player.name AS Name, v2.player.name AS Friend """ Then the result should be, in any order: | Name | Friend | @@ -140,7 +166,7 @@ Feature: Basic match When executing query: """ MATCH (v1:player{name: "Danny Green"}) <-[:like]-> (v2) - RETURN v1.name AS Name, v2.name AS Friend + RETURN v1.player.name AS Name, v2.player.name AS Friend """ Then the result should be, in any order: | Name | Friend | @@ -152,7 +178,7 @@ Feature: Basic match When executing query: """ MATCH (v1:player{name: "Danny Green"}) -[:like]- (v2) - RETURN v1.name AS Name, v2.name AS Friend + RETURN v1.player.name AS Name, v2.player.name AS Friend """ Then the result should be, in any order: | Name | Friend | @@ -166,7 +192,7 @@ Feature: Basic match When executing query: """ MATCH (v1:player{age: 28}) -[:like]-> (v2) -[:like]-> (v3) - RETURN v1.name AS Player, v2.name AS Friend, v3.name AS FoF + RETURN v1.player.name AS Player, v2.player.name AS Friend, v3.player.name AS FoF """ Then the result should be, in any order: | Player | Friend | FoF | @@ -179,9 +205,9 @@ Feature: Basic match MATCH (v1:player{name: 'Tony Parker'}) -[r1:serve]-> (v2) <-[r2:serve]- (v3) WHERE r1.start_year <= r2.end_year AND r1.end_year >= r2.start_year AND - v1.name <> v3.name AND - v3.name STARTS WITH 'D' - RETURN v1.name AS Player, v2.name AS Team, v3.name AS Teammate + v1.player.name <> v3.player.name AND + v3.player.name STARTS WITH 'D' + RETURN v1.player.name AS Player, v2.team.name AS Team, v3.player.name AS Teammate """ Then the result should be, in any order: | Player | Team | Teammate | @@ -194,7 +220,7 @@ Feature: Basic match When executing query: """ MATCH (:player{name:'Dwyane Wade'}) -[:like]-> () -[:like]-> (v3) - RETURN v3.name AS Name + RETURN v3.player.name AS Name """ Then the result should be, in any order: | Name | @@ -208,7 +234,7 @@ Feature: Basic match When executing query: """ MATCH (:player{name:'Dwyane Wade'}) -[:like]-> () -[:like]-> (v3) - RETURN DISTINCT v3.name AS Name + RETURN DISTINCT v3.player.name AS Name """ Then the result should be, in any order: | Name | @@ -222,7 +248,7 @@ Feature: Basic match When executing query: """ MATCH (:player{name:'Dejounte Murray'}) -[:like]-> (v) - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC """ Then the result should be, in any order: @@ -241,7 +267,7 @@ Feature: Basic match When executing query: """ MATCH (:player{name:'Dejounte Murray'}) -[:like]-> (v) - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC LIMIT 3 """ @@ -253,7 +279,7 @@ Feature: Basic match When executing query: """ MATCH (:player{name:'Dejounte Murray'}) -[:like]-> (v) - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC SKIP 3 """ @@ -270,7 +296,7 @@ Feature: Basic match When executing query: """ MATCH (:player{name:'Dejounte Murray'}) -[:like]-> (v) - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC SKIP 3 LIMIT 3 @@ -283,7 +309,7 @@ Feature: Basic match When executing query: """ MATCH (:player{name:'Dejounte Murray'}) -[:like]-> (v) - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC SKIP 11 LIMIT 3 @@ -293,7 +319,7 @@ Feature: Basic match When executing query: """ MATCH (:player{name:'Dejounte Murray'}) -[:like]-> (v) - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC LIMIT 0 """ @@ -304,7 +330,7 @@ Feature: Basic match When executing query: """ MATCH (:player{name:'Dejounte Murray'}) -[:like]-> (v) - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY v.age DESC, v.name ASC """ Then a SemanticError should be raised at runtime: Only column name can be used as sort item @@ -319,17 +345,17 @@ Feature: Basic match | <("Tony Parker")> | ("Tony Parker") | When executing query: """ - MATCH p = (n:player{name:"LeBron James"})-[:like]->(m) return p, n.name, m.name + MATCH p = (n:player{name:"LeBron James"})-[:like]->(m) return p, n.player.name, m.player.name """ Then the result should be, in any order, with relax comparison: - | p | n.name | m.name | - | <("LeBron James")-[:like@0]->("Ray Allen")> | "LeBron James" | "Ray Allen" | + | p | n.player.name | m.player.name | + | <("LeBron James")-[:like@0]->("Ray Allen")> | "LeBron James" | "Ray Allen" | When executing query: """ - MATCH p = (n:player{name:"LeBron James"})<-[:like]-(m) return p, n.name, m.name + MATCH p = (n:player{name:"LeBron James"})<-[:like]-(m) return p, n.player.name, m.player.name """ Then the result should be, in any order, with relax comparison: - | p | n.name | m.name | + | p | n.player.name | m.player.name | | <("LeBron James")<-[:like@0]-("Carmelo Anthony")> | "LeBron James" | "Carmelo Anthony" | | <("LeBron James")<-[:like@0]-("Chris Paul")> | "LeBron James" | "Chris Paul" | | <("LeBron James")<-[:like@0]-("Danny Green")> | "LeBron James" | "Danny Green" | @@ -338,10 +364,10 @@ Feature: Basic match | <("LeBron James")<-[:like@0]-("Kyrie Irving")> | "LeBron James" | "Kyrie Irving" | When executing query: """ - MATCH p = (n:player{name:"LeBron James"})-[:like]-(m) return p, n.name, m.name + MATCH p = (n:player{name:"LeBron James"})-[:like]-(m) return p, n.player.name, m.player.name """ Then the result should be, in any order, with relax comparison: - | p | n.name | m.name | + | p | n.player.name | m.player.name | | <("LeBron James")<-[:like@0]-("Carmelo Anthony")> | "LeBron James" | "Carmelo Anthony" | | <("LeBron James")<-[:like@0]-("Chris Paul")> | "LeBron James" | "Chris Paul" | | <("LeBron James")<-[:like@0]-("Danny Green")> | "LeBron James" | "Danny Green" | @@ -351,11 +377,11 @@ Feature: Basic match | <("LeBron James")-[:like@0]->("Ray Allen")> | "LeBron James" | "Ray Allen" | When executing query: """ - MATCH p = (n:player{name:"LeBron James"})-[:like]->(m)-[:like]->(k) return p, n.name, m.name, k.name + MATCH p = (n:player{name:"LeBron James"})-[:like]->(m)-[:like]->(k) return p, n.player.name, m.player.name, k.player.name """ Then the result should be, in any order, with relax comparison: - | p | n.name | m.name | k.name | - | <("LeBron James")-[:like@0]->("Ray Allen")-[:like@0]->("Rajon Rondo")> | "LeBron James" | "Ray Allen" | "Rajon Rondo" | + | p | n.player.name | m.player.name | k.player.name | + | <("LeBron James")-[:like@0]->("Ray Allen")-[:like@0]->("Rajon Rondo")> | "LeBron James" | "Ray Allen" | "Rajon Rondo" | When executing query: """ MATCH p=(:player{name:"LeBron James"})-[:like]->()-[:like]->() RETURN * @@ -376,7 +402,7 @@ Feature: Basic match | [:like "Tony Parker"->"Tim Duncan" @0 {likeness: 95}] | true | When executing query: """ - MATCH (:player{name:"Tony Parker"})-[r]->(m) where exists(m.likeness) return r, exists({a:12}.a) + MATCH (:player{name:"Tony Parker"})-[r]->(m) where exists(m.team.likeness) return r, exists({a:12}.a) """ Then the result should be, in any order, with relax comparison: | r | exists({a:12}.a) | @@ -403,7 +429,7 @@ Feature: Basic match | r | When executing query: """ - match (:player{name:"Tony Parker"})-[r]->(m) where exists(m.age) return r + match (:player{name:"Tony Parker"})-[r]->(m) where exists(m.player.age) return r """ Then the result should be, in any order, with relax comparison: | r | @@ -520,3 +546,32 @@ Feature: Basic match MATCH (p)-[:serve*0..3]->(t) RETURN p """ Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. + + Scenario: can't get property of vertex + When executing query: + """ + MATCH (v:player{name:"Tim Duncan"}) return v.name + """ + Then a SemanticError should be raised at runtime: To get the property of the vertex in `v.name', should use the format `var.tag.prop' + When executing query: + """ + MATCH (v:player)-[]->(b) WHERE v.age > 30 return v.player.name + """ + Then a SemanticError should be raised at runtime: To get the property of the vertex in `v.age', should use the format `var.tag.prop' + When executing query: + """ + MATCH (v:player)-[:like]->(b) WHERE v.player.age > 30 return v.player.name, b.age + """ + Then a SemanticError should be raised at runtime: To get the property of the vertex in `b.age', should use the format `var.tag.prop' + When executing query: + """ + MATCH (:player{name:"Tony Parker"})-[r]->(m) where exists(m.age) return r + """ + Then a SemanticError should be raised at runtime: To get the property of the vertex in `m.age', should use the format `var.tag.prop' + When executing query: + """ + MATCH (v :player{name:"Tim Duncan"})-[]-(v2)-[]-(v3) + WITH v3.name as names + RETURN count(names) + """ + Then a SemanticError should be raised at runtime: To get the property of the vertex in `v3.name', should use the format `var.tag.prop' diff --git a/tests/tck/features/match/Base.feature b/tests/tck/features/match/Base.feature index 44e524d830a..b86b7bab3cc 100644 --- a/tests/tck/features/match/Base.feature +++ b/tests/tck/features/match/Base.feature @@ -16,7 +16,7 @@ Feature: Basic match | ("Yao Ming") | When executing query: """ - MATCH (v:player) WHERE v.age < 0 RETURN v + MATCH (v:player) WHERE v.player.age < 0 RETURN v """ Then the result should be, in any order, with relax comparison: | v | @@ -26,14 +26,14 @@ Feature: Basic match | ("Null4" :player{age: -4, name: NULL}) | When executing query: """ - MATCH (v:player) WHERE v.name == "Yao Ming" RETURN v.age AS Age + MATCH (v:player) WHERE v.player.name == "Yao Ming" RETURN v.player.age AS Age """ Then the result should be, in any order: | Age | | 38 | When executing query: """ - MATCH (v:player {age: 29}) return v.name AS Name + MATCH (v:player {age: 29}) return v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -43,7 +43,7 @@ Feature: Basic match | 'Dejounte Murray' | When executing query: """ - MATCH (v:player {age: 29}) WHERE v.name STARTS WITH "J" return v.name AS Name + MATCH (v:player {age: 29}) WHERE v.player.name STARTS WITH "J" return v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -51,7 +51,7 @@ Feature: Basic match | 'Jonathon Simmons' | When executing query: """ - MATCH (v:player) WHERE v.age >= 38 AND v.age < 45 return v.name AS Name, v.age AS Age + MATCH (v:player) WHERE v.player.age >= 38 AND v.player.age < 45 return v.player.name AS Name, v.player.age AS Age """ Then the result should be, in any order: | Name | Age | @@ -67,13 +67,13 @@ Feature: Basic match | 'Tracy McGrady' | 39 | When executing query: """ - MATCH (v:player) where v.name == null RETURN v + MATCH (v:player) where v.player.name == null RETURN v """ Then the result should be, in any order, with relax comparison: | v | When executing query: """ - MATCH (v:player) where v.name == 3 RETURN v + MATCH (v:player) where v.player.name == 3 RETURN v """ Then the result should be, in any order, with relax comparison: | v | @@ -86,7 +86,7 @@ Feature: Basic match | ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) | When executing query: """ - MATCH (v:player) where v.age == 38 RETURN *, v.age + 100 AS age + MATCH (v:player) where v.player.age == 38 RETURN *, v.player.age + 100 AS age """ Then the result should be, in any order, with relax comparison: | v | age | @@ -95,19 +95,44 @@ Feature: Basic match | ("Yao Ming" :player{age: 38, name: "Yao Ming"}) | 138 | When executing query: """ - MATCH (v:player) where v.age > 9223372036854775807+1 return v + MATCH (v:player) where v.player.age > 9223372036854775807+1 return v """ Then a SemanticError should be raised at runtime: result of (9223372036854775807+1) cannot be represented as an integer When executing query: """ - MATCH (v:player) where v.age > -9223372036854775808-1 return v + MATCH (v:player) where v.player.age > -9223372036854775808-1 return v """ Then a SemanticError should be raised at runtime: result of (-9223372036854775808-1) cannot be represented as an integer Scenario: One step When executing query: """ - MATCH (v1:player{name: "LeBron James"}) -[r]-> (v2) RETURN type(r) AS Type, v2.name AS Name + MATCH (v1:player{name: "LeBron James"}) -[r]-> (v2) + RETURN type(r) AS Type, CASE WHEN v2.tea.name IS NOT NULL THEN v2.tea.name WHEN v2.playe.name IS NOT NULL THEN v2.playe.name ELSE "abc" END AS Name + """ + Then the result should be, in any order: + | Type | Name | + | "like" | "abc" | + | "serve" | "abc" | + | "serve" | "abc" | + | "serve" | "abc" | + | "serve" | "abc" | + When executing query: + """ + MATCH (v1:player{name: "LeBron James"}) -[r]-> (v2) + RETURN type(r) AS Type, CASE WHEN v2.tea.name IS NOT NULL THEN v2.tea.name WHEN v2.playe.name IS NOT NULL THEN v2.playe.name END AS Name + """ + Then the result should be, in any order: + | Type | Name | + | "like" | NULL | + | "serve" | NULL | + | "serve" | NULL | + | "serve" | NULL | + | "serve" | NULL | + When executing query: + """ + MATCH (v1:player{name: "LeBron James"}) -[r]-> (v2) + RETURN type(r) AS Type, CASE WHEN v2.team.name IS NOT NULL THEN v2.team.name WHEN v2.player.name IS NOT NULL THEN v2.player.name END AS Name """ Then the result should be, in any order: | Type | Name | @@ -118,7 +143,8 @@ Feature: Basic match | "serve" | "Cavaliers" | When executing query: """ - MATCH (v1:player{name: "LeBron James"}) -[r:serve|:like]-> (v2) RETURN type(r) AS Type, v2.name AS Name + MATCH (v1:player{name: "LeBron James"}) -[r:serve|:like]-> (v2) + RETURN type(r) AS Type, CASE WHEN v2.team.name IS NOT NULL THEN v2.team.name WHEN v2.player.name IS NOT NULL THEN v2.player.name END AS Name """ Then the result should be, in any order: | Type | Name | @@ -130,7 +156,7 @@ Feature: Basic match When executing query: """ MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2) - RETURN type(r) AS Type, v2.name AS Name + RETURN type(r) AS Type, v2.team.name AS Name """ Then the result should be, in any order: | Type | Name | @@ -141,7 +167,7 @@ Feature: Basic match When executing query: """ MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2 {name: "Cavaliers"}) - RETURN type(r) AS Type, v2.name AS Name + RETURN type(r) AS Type, v2.team.name AS Name """ Then the result should be, in any order: | Type | Name | @@ -159,7 +185,7 @@ Feature: Basic match When executing query: """ MATCH (v1:player{name: "Danny Green"}) -[:like]-> (v2) - RETURN v1.name AS Name, v2.name AS Friend + RETURN v1.player.name AS Name, v2.player.name AS Friend """ Then the result should be, in any order: | Name | Friend | @@ -169,7 +195,7 @@ Feature: Basic match When executing query: """ MATCH (v1:player{name: "Danny Green"}) <-[:like]- (v2) - RETURN v1.name AS Name, v2.name AS Friend + RETURN v1.player.name AS Name, v2.player.name AS Friend """ Then the result should be, in any order: | Name | Friend | @@ -178,7 +204,7 @@ Feature: Basic match When executing query: """ MATCH (v1:player{name: "Danny Green"}) <-[:like]-> (v2) - RETURN v1.name AS Name, v2.name AS Friend + RETURN v1.player.name AS Name, v2.player.name AS Friend """ Then the result should be, in any order: | Name | Friend | @@ -190,7 +216,7 @@ Feature: Basic match When executing query: """ MATCH (v1:player{name: "Danny Green"}) -[:like]- (v2) - RETURN v1.name AS Name, v2.name AS Friend + RETURN v1.player.name AS Name, v2.player.name AS Friend """ Then the result should be, in any order: | Name | Friend | @@ -201,7 +227,7 @@ Feature: Basic match | "Danny Green" | "Tim Duncan" | When executing query: """ - MATCH (v:player)-[e:like]-(v2) where v.age == 38 RETURN * + MATCH (v:player)-[e:like]-(v2) where v.player.age == 38 RETURN * """ Then the result should be, in any order, with relax comparison: | v | e | v2 | @@ -230,7 +256,7 @@ Feature: Basic match When executing query: """ MATCH (v1:player{age: 28}) -[:like]-> (v2) -[:like]-> (v3) - RETURN v1.name AS Player, v2.name AS Friend, v3.name AS FoF + RETURN v1.player.name AS Player, v2.player.name AS Friend, v3.player.name AS FoF """ Then the result should be, in any order: | Player | Friend | FoF | @@ -243,9 +269,9 @@ Feature: Basic match MATCH (v1:player{name: 'Tony Parker'}) -[r1:serve]-> (v2) <-[r2:serve]- (v3) WHERE r1.start_year <= r2.end_year AND r1.end_year >= r2.start_year AND - v1.name <> v3.name AND - v3.name STARTS WITH 'D' - RETURN v1.name AS Player, v2.name AS Team, v3.name AS Teammate + v1.player.name <> v3.player.name AND + v3.player.name STARTS WITH 'D' + RETURN v1.player.name AS Player, v2.team.name AS Team, v3.player.name AS Teammate """ Then the result should be, in any order: | Player | Team | Teammate | @@ -258,7 +284,7 @@ Feature: Basic match When executing query: """ MATCH (:player{name:'Dwyane Wade'}) -[:like]-> () -[:like]-> (v3) - RETURN v3.name AS Name + RETURN v3.player.name AS Name """ Then the result should be, in any order: | Name | @@ -272,7 +298,7 @@ Feature: Basic match When executing query: """ MATCH (:player{name:'Dwyane Wade'}) -[:like]-> () -[:like]-> (v3) - RETURN DISTINCT v3.name AS Name + RETURN DISTINCT v3.player.name AS Name """ Then the result should be, in any order: | Name | @@ -286,7 +312,7 @@ Feature: Basic match When executing query: """ MATCH (:player{name:'Dejounte Murray'}) -[:like]-> (v) - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC """ Then the result should be, in any order: @@ -305,7 +331,7 @@ Feature: Basic match When executing query: """ MATCH (:player{name:'Dejounte Murray'}) -[:like]-> (v) - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC LIMIT 3 """ @@ -317,7 +343,7 @@ Feature: Basic match When executing query: """ MATCH (:player{name:'Dejounte Murray'}) -[:like]-> (v) - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC SKIP 3 """ @@ -334,7 +360,7 @@ Feature: Basic match When executing query: """ MATCH (:player{name:'Dejounte Murray'}) -[:like]-> (v) - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC SKIP 3 LIMIT 3 @@ -347,7 +373,7 @@ Feature: Basic match When executing query: """ MATCH (:player{name:'Dejounte Murray'}) -[:like]-> (v) - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC SKIP 11 LIMIT 3 @@ -357,7 +383,7 @@ Feature: Basic match When executing query: """ MATCH (:player{name:'Dejounte Murray'}) -[:like]-> (v) - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC LIMIT 0 """ @@ -368,8 +394,8 @@ Feature: Basic match When executing query: """ MATCH (:player{name:'Dejounte Murray'}) -[:like]-> (v) - RETURN v.name AS Name, v.age AS Age - ORDER BY v.age DESC, v.name ASC + RETURN v.player.name AS Name, v.player.age AS Age + ORDER BY v.player.age DESC, v.player.name ASC """ Then a SemanticError should be raised at runtime: Only column name can be used as sort item @@ -383,17 +409,17 @@ Feature: Basic match | <("Tony Parker")> | ("Tony Parker") | When executing query: """ - MATCH p = (n:player{name:"LeBron James"})-[:like]->(m) return p, n.name, m.name + MATCH p = (n:player{name:"LeBron James"})-[:like]->(m) return p, n.player.name, m.player.name """ Then the result should be, in any order, with relax comparison: - | p | n.name | m.name | - | <("LeBron James")-[:like@0]->("Ray Allen")> | "LeBron James" | "Ray Allen" | + | p | n.player.name | m.player.name | + | <("LeBron James")-[:like@0]->("Ray Allen")> | "LeBron James" | "Ray Allen" | When executing query: """ - MATCH p = (n:player{name:"LeBron James"})<-[:like]-(m) return p, n.name, m.name + MATCH p = (n:player{name:"LeBron James"})<-[:like]-(m) return p, n.player.name, m.player.name """ Then the result should be, in any order, with relax comparison: - | p | n.name | m.name | + | p | n.player.name | m.player.name | | <("LeBron James")<-[:like@0]-("Carmelo Anthony")> | "LeBron James" | "Carmelo Anthony" | | <("LeBron James")<-[:like@0]-("Chris Paul")> | "LeBron James" | "Chris Paul" | | <("LeBron James")<-[:like@0]-("Danny Green")> | "LeBron James" | "Danny Green" | @@ -402,10 +428,10 @@ Feature: Basic match | <("LeBron James")<-[:like@0]-("Kyrie Irving")> | "LeBron James" | "Kyrie Irving" | When executing query: """ - MATCH p = (n:player{name:"LeBron James"})-[:like]-(m) return p, n.name, m.name + MATCH p = (n:player{name:"LeBron James"})-[:like]-(m) return p, n.player.name, m.player.name """ Then the result should be, in any order, with relax comparison: - | p | n.name | m.name | + | p | n.player.name | m.player.name | | <("LeBron James")<-[:like@0]-("Carmelo Anthony")> | "LeBron James" | "Carmelo Anthony" | | <("LeBron James")<-[:like@0]-("Chris Paul")> | "LeBron James" | "Chris Paul" | | <("LeBron James")<-[:like@0]-("Danny Green")> | "LeBron James" | "Danny Green" | @@ -415,11 +441,11 @@ Feature: Basic match | <("LeBron James")-[:like@0]->("Ray Allen")> | "LeBron James" | "Ray Allen" | When executing query: """ - MATCH p = (n:player{name:"LeBron James"})-[:like]->(m)-[:like]->(k) return p, n.name, m.name, k.name + MATCH p = (n:player{name:"LeBron James"})-[:like]->(m)-[:like]->(k) return p, n.player.name, m.player.name, k.player.name """ Then the result should be, in any order, with relax comparison: - | p | n.name | m.name | k.name | - | <("LeBron James")-[:like@0]->("Ray Allen")-[:like@0]->("Rajon Rondo")> | "LeBron James" | "Ray Allen" | "Rajon Rondo" | + | p | n.player.name | m.player.name | k.player.name | + | <("LeBron James")-[:like@0]->("Ray Allen")-[:like@0]->("Rajon Rondo")> | "LeBron James" | "Ray Allen" | "Rajon Rondo" | When executing query: """ MATCH p=(:player{name:"LeBron James"})-[:like]->()-[:like]->() RETURN * @@ -480,7 +506,7 @@ Feature: Basic match | [:like "Tony Parker"->"Tim Duncan" @0 {likeness: 95}] | true | When executing query: """ - match (:player{name:"Tony Parker"})-[r]->(m) where exists(m.likeness) return r, exists({a:12}.a) + match (:player{name:"Tony Parker"})-[r]->(m) where exists(m.player.likeness) return r, exists({a:12}.a) """ Then the result should be, in any order, with relax comparison: | r | exists({a:12}.a) | @@ -507,7 +533,7 @@ Feature: Basic match | r | When executing query: """ - match (:player{name:"Tony Parker"})-[r]->(m) where exists(m.age) return r + match (:player{name:"Tony Parker"})-[r]->(m) where exists(m.player.age) return r """ Then the result should be, in any order, with relax comparison: | r | @@ -588,7 +614,7 @@ Feature: Basic match Then a SyntaxError should be raised at runtime: syntax error near `)' When executing query: """ - MATCH (v:player) where v.name return v + MATCH (v:player) where v.player.name return v """ Then a ExecutionError should be raised at runtime: Wrong type result, the type should be NULL, EMPTY or BOOL @@ -630,3 +656,32 @@ Feature: Basic match MATCH (p)-[:serve*0..3]->(t) RETURN p """ Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. + + Scenario: can't get property of vertex + When executing query: + """ + MATCH (v:player{name:"Tim Duncan"}) return v.name + """ + Then a SemanticError should be raised at runtime: To get the property of the vertex in `v.name', should use the format `var.tag.prop' + When executing query: + """ + MATCH (v:player)-[]->(b) WHERE v.age > 30 return v.player.name + """ + Then a SemanticError should be raised at runtime: To get the property of the vertex in `v.age', should use the format `var.tag.prop' + When executing query: + """ + MATCH (v:player)-[:like]->(b) WHERE v.player.age > 30 return v.player.name, b.age + """ + Then a SemanticError should be raised at runtime: To get the property of the vertex in `b.age', should use the format `var.tag.prop' + When executing query: + """ + MATCH (:player{name:"Tony Parker"})-[r]->(m) where exists(m.age) return r + """ + Then a SemanticError should be raised at runtime: To get the property of the vertex in `m.age', should use the format `var.tag.prop' + When executing query: + """ + MATCH (v :player{name:"Tim Duncan"})-[]-(v2)-[]-(v3) + WITH v3.name as names + RETURN count(names) + """ + Then a SemanticError should be raised at runtime: To get the property of the vertex in `v3.name', should use the format `var.tag.prop' diff --git a/tests/tck/features/match/IndexSelecting.feature b/tests/tck/features/match/IndexSelecting.feature index 462d42e60d6..0de5e3646f2 100644 --- a/tests/tck/features/match/IndexSelecting.feature +++ b/tests/tck/features/match/IndexSelecting.feature @@ -46,7 +46,7 @@ Feature: Index selecting for match statement # Prefix Index When profiling query: """ - MATCH (v:player {name: "Yao Ming"}) RETURN v.name AS name + MATCH (v:player {name: "Yao Ming"}) RETURN v.player.name AS name """ Then the result should be, in any order, with relax comparison: | name | @@ -59,7 +59,7 @@ Feature: Index selecting for match statement | 0 | Start | | | When profiling query: """ - MATCH (v:player) WHERE v.name == "Tim Duncan" and v.name < "Zom" RETURN v.name AS name + MATCH (v:player) WHERE v.player.name == "Tim Duncan" and v.player.name < "Zom" RETURN v.player.name AS name """ Then the result should be, in any order, with relax comparison: | name | @@ -73,7 +73,7 @@ Feature: Index selecting for match statement | 0 | Start | | | When profiling query: """ - MATCH (v:player) WHERE v.name=="Tim Duncan" and v.age>4 and v.name>"A" RETURN v.name AS name + MATCH (v:player) WHERE v.player.name=="Tim Duncan" and v.player.age>4 and v.player.name>"A" RETURN v.player.name AS name """ Then the result should be, in any order, with relax comparison: | name | @@ -87,7 +87,7 @@ Feature: Index selecting for match statement | 0 | Start | | | When profiling query: """ - MATCH (v:player{name:"Tim Duncan"}) WHERE v.name < "Zom" RETURN v.name AS name + MATCH (v:player{name:"Tim Duncan"}) WHERE v.player.name < "Zom" RETURN v.player.name AS name """ Then the result should be, in any order, with relax comparison: | name | @@ -102,7 +102,7 @@ Feature: Index selecting for match statement # Range Index When profiling query: """ - MATCH (v:player) WHERE v.name > "Tim" and v.name < "Zom" RETURN v.name AS name + MATCH (v:player) WHERE v.player.name > "Tim" and v.player.name < "Zom" RETURN v.player.name AS name """ Then the result should be, in any order, with relax comparison: | name | @@ -118,7 +118,7 @@ Feature: Index selecting for match statement # Degeneration to FullScan Index When executing query: """ - MATCH (v:player) WHERE v.score < 20 RETURN v.name AS name + MATCH (v:player) WHERE v.player.score < 20 RETURN v.player.name AS name """ Then the result should be, in any order, with relax comparison: | name | @@ -126,7 +126,7 @@ Feature: Index selecting for match statement # Degeneration to Prefix Index When profiling query: """ - MATCH (v:player) WHERE v.name == "Tim Duncan" and v.score == 28 RETURN v.name AS name + MATCH (v:player) WHERE v.player.name == "Tim Duncan" and v.player.score == 28 RETURN v.player.name AS name """ Then the result should be, in any order, with relax comparison: | name | diff --git a/tests/tck/features/match/MatchById.IntVid.feature b/tests/tck/features/match/MatchById.IntVid.feature index 71b87f56b16..ae3bf0b6ef1 100644 --- a/tests/tck/features/match/MatchById.IntVid.feature +++ b/tests/tck/features/match/MatchById.IntVid.feature @@ -97,11 +97,11 @@ Feature: Integer Vid Match By Id """ MATCH (v1) -[r]-> (v2) WHERE id(v1) == hash("LeBron James") - RETURN type(r) AS Type, v2.name AS Name + RETURN type(r) AS Type, v2.team.name AS Name """ Then the result should be, in any order, with relax comparison: | Type | Name | - | 'like' | 'Ray Allen' | + | 'like' | NULL | | 'serve' | 'Cavaliers' | | 'serve' | 'Heat' | | 'serve' | 'Cavaliers' | @@ -110,11 +110,11 @@ Feature: Integer Vid Match By Id """ MATCH (v1) -[r:serve|:like]-> (v2) WHERE id(v1) == hash("LeBron James") - RETURN type(r) AS Type, v2.name AS Name + RETURN type(r) AS Type, v2.team.name AS Name """ Then the result should be, in any order, with relax comparison: | Type | Name | - | 'like' | 'Ray Allen' | + | 'like' | NULL | | 'serve' | 'Cavaliers' | | 'serve' | 'Heat' | | 'serve' | 'Cavaliers' | @@ -123,7 +123,7 @@ Feature: Integer Vid Match By Id """ MATCH (v1) -[r:serve]-> (v2) WHERE id(v1) == hash("LeBron James") - RETURN type(r) AS Type, v2.name AS Name + RETURN type(r) AS Type, v2.team.name AS Name """ Then the result should be, in any order, with relax comparison: | Type | Name | @@ -135,7 +135,7 @@ Feature: Integer Vid Match By Id """ MATCH (v1) -[r:serve]-> (v2 {name: "Cavaliers"}) WHERE id(v1) == hash("LeBron James") - RETURN type(r) AS Type, v2.name AS Name + RETURN type(r) AS Type, v2.team.name AS Name """ Then the result should be, in any order, with relax comparison: | Type | Name | @@ -145,7 +145,7 @@ Feature: Integer Vid Match By Id """ MATCH (v1) -[:like]-> (v2) WHERE id(v1) == hash("Danny Green") - RETURN v1.name AS Name, v2.name AS Friend + RETURN v1.player.name AS Name, v2.player.name AS Friend """ Then the result should be, in any order, with relax comparison: | Name | Friend | @@ -156,7 +156,7 @@ Feature: Integer Vid Match By Id """ MATCH (v1) <-[:like]- (v2) WHERE id(v1) == hash("Danny Green") - RETURN v1.name AS Name, v2.name AS Friend + RETURN v1.player.name AS Name, v2.player.name AS Friend """ Then the result should be, in any order, with relax comparison: | Name | Friend | @@ -166,7 +166,7 @@ Feature: Integer Vid Match By Id """ MATCH (v1) <-[:like]-> (v2) WHERE id(v1) == hash("Danny Green") - RETURN v1.name AS Name, v2.name AS Friend + RETURN v1.player.name AS Name, v2.player.name AS Friend """ Then the result should be, in any order, with relax comparison: | Name | Friend | @@ -179,7 +179,7 @@ Feature: Integer Vid Match By Id """ MATCH (v1) -[:like]- (v2) WHERE id(v1) == hash("Danny Green") - RETURN v1.name AS Name, v2.name AS Friend + RETURN v1.player.name AS Name, v2.player.name AS Friend """ Then the result should be, in any order, with relax comparison: | Name | Friend | @@ -194,7 +194,7 @@ Feature: Integer Vid Match By Id """ MATCH (v1) -[:like]-> (v2) -[:like]-> (v3) WHERE id(v1) == hash("Tim Duncan") - RETURN v1.name AS Player, v2.name AS Friend, v3.name AS FoF + RETURN v1.player.name AS Player, v2.player.name AS Friend, v3.player.name AS FoF """ Then the result should be, in any order, with relax comparison: | Player | Friend | FoF | @@ -208,7 +208,7 @@ Feature: Integer Vid Match By Id """ MATCH (v1) -[:like]-> () -[:like]-> (v3) WHERE id(v1) == hash('Dwyane Wade') - RETURN v3.name AS Name + RETURN v3.player.name AS Name """ Then the result should be, in any order, with relax comparison: | Name | @@ -223,7 +223,7 @@ Feature: Integer Vid Match By Id """ MATCH (v1) -[:like]-> () -[:like]-> (v3) WHERE id(v1) == hash('Dwyane Wade') - RETURN DISTINCT v3.name AS Name + RETURN DISTINCT v3.player.name AS Name """ Then the result should be, in any order, with relax comparison: | Name | @@ -238,7 +238,7 @@ Feature: Integer Vid Match By Id """ MATCH (v1) -[:like]-> (v) WHERE id(v1) == hash('Dejounte Murray') - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC """ Then the result should be, in any order, with relax comparison: @@ -258,7 +258,7 @@ Feature: Integer Vid Match By Id """ MATCH (v1) -[:like]-> (v) WHERE id(v1) == hash('Dejounte Murray') - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASCENDING LIMIT 3 """ @@ -271,7 +271,7 @@ Feature: Integer Vid Match By Id """ MATCH (v1) -[:like]-> (v) WHERE id(v1) == hash('Dejounte Murray') - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESCENDING, Name ASC SKIP 3 """ @@ -289,7 +289,7 @@ Feature: Integer Vid Match By Id """ MATCH (v1) -[:like]-> (v) WHERE id(v1) == hash('Dejounte Murray') - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC SKIP 3 LIMIT 3 @@ -303,7 +303,7 @@ Feature: Integer Vid Match By Id """ MATCH (v1) -[:like]-> (v) WHERE id(v1) == hash('Dejounte Murray') - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC SKIP 11 LIMIT 3 @@ -314,7 +314,7 @@ Feature: Integer Vid Match By Id """ MATCH (v1) -[:like]-> (v) WHERE id(v1) == hash('Dejounte Murray') - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC LIMIT 0 """ @@ -324,7 +324,7 @@ Feature: Integer Vid Match By Id """ MATCH (v1) -[:like]-> (v) WHERE id(v1) == hash('Dejounte Murray') - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY v.age DESC, v.name ASC LIMIT 0 """ @@ -344,19 +344,19 @@ Feature: Integer Vid Match By Id """ MATCH p = (n)-[:like]->(m) WHERE id(n) == hash("LeBron James") - RETURN p, n.name, m.name + RETURN p, n.player.name, m.player.name """ Then the result should be, in any order, with relax comparison: - | p | n.name | m.name | - | <("LeBron James")-[:like]->("Ray Allen")> | "LeBron James" | "Ray Allen" | + | p | n.player.name | m.player.name | + | <("LeBron James")-[:like]->("Ray Allen")> | "LeBron James" | "Ray Allen" | When executing query: """ MATCH p = (n)<-[:like]-(m) WHERE id(n) == hash("LeBron James") - RETURN p, n.name, m.name + RETURN p, n.player.name, m.player.name """ Then the result should be, in any order, with relax comparison: - | p | n.name | m.name | + | p | n.player.name | m.player.name | | <("LeBron James")<-[:like]-("Carmelo Anthony")> | "LeBron James" | "Carmelo Anthony" | | <("LeBron James")<-[:like]-("Chris Paul")> | "LeBron James" | "Chris Paul" | | <("LeBron James")<-[:like]-("Danny Green")> | "LeBron James" | "Danny Green" | @@ -367,10 +367,10 @@ Feature: Integer Vid Match By Id """ MATCH p = (n)-[:like]-(m) WHERE id(n) == hash("LeBron James") - RETURN p, n.name, m.name + RETURN p, n.player.name, m.player.name """ Then the result should be, in any order, with relax comparison: - | p | n.name | m.name | + | p | n.player.name | m.player.name | | <("LeBron James")<-[:like]-("Carmelo Anthony")> | "LeBron James" | "Carmelo Anthony" | | <("LeBron James")<-[:like]-("Chris Paul")> | "LeBron James" | "Chris Paul" | | <("LeBron James")<-[:like]-("Danny Green")> | "LeBron James" | "Danny Green" | @@ -382,11 +382,11 @@ Feature: Integer Vid Match By Id """ MATCH p = (n)-[:like]->(m)-[:like]->(k) WHERE id(n) == hash("LeBron James") - RETURN p, n.name, m.name, k.name + RETURN p, n.player.name, m.player.name, k.player.name """ Then the result should be, in any order, with relax comparison: - | p | n.name | m.name | k.name | - | <("LeBron James")-[:like]->("Ray Allen")-[:like]->("Rajon Rondo")> | "LeBron James" | "Ray Allen" | "Rajon Rondo" | + | p | n.player.name | m.player.name | k.player.name | + | <("LeBron James")-[:like]->("Ray Allen")-[:like]->("Rajon Rondo")> | "LeBron James" | "Ray Allen" | "Rajon Rondo" | When executing query: """ MATCH p = (n)-[:like]->()-[:like]->() diff --git a/tests/tck/features/match/MatchById.feature b/tests/tck/features/match/MatchById.feature index c90b32d7a5a..5c6929397c6 100644 --- a/tests/tck/features/match/MatchById.feature +++ b/tests/tck/features/match/MatchById.feature @@ -97,11 +97,11 @@ Feature: Match By Id """ MATCH (v1) -[r]-> (v2) WHERE id(v1) == "LeBron James" - RETURN type(r) AS Type, v2.name AS Name + RETURN type(r) AS Type, CASE WHEN v2.team.name IS NOT NULL THEN v2.team.name WHEN v2.player.name IS NOT NULL THEN v2.player.name END AS Name """ Then the result should be, in any order, with relax comparison: | Type | Name | - | 'like' | 'Ray Allen' | + | 'like' | "Ray Allen" | | 'serve' | 'Cavaliers' | | 'serve' | 'Heat' | | 'serve' | 'Cavaliers' | @@ -110,11 +110,11 @@ Feature: Match By Id """ MATCH (v1) -[r:serve|:like]-> (v2) WHERE id(v1) == "LeBron James" - RETURN type(r) AS Type, v2.name AS Name + RETURN type(r) AS Type, CASE WHEN v2.team.name IS NOT NULL THEN v2.team.name WHEN v2.player.name IS NOT NULL THEN v2.player.name END AS Name """ Then the result should be, in any order, with relax comparison: | Type | Name | - | 'like' | 'Ray Allen' | + | 'like' | "Ray Allen" | | 'serve' | 'Cavaliers' | | 'serve' | 'Heat' | | 'serve' | 'Cavaliers' | @@ -123,7 +123,7 @@ Feature: Match By Id """ MATCH (v1) -[r:serve]-> (v2) WHERE id(v1) == "LeBron James" - RETURN type(r) AS Type, v2.name AS Name + RETURN type(r) AS Type, v2.team.name AS Name """ Then the result should be, in any order, with relax comparison: | Type | Name | @@ -135,7 +135,7 @@ Feature: Match By Id """ MATCH (v1) -[r:serve]-> (v2 {name: "Cavaliers"}) WHERE id(v1) == "LeBron James" - RETURN type(r) AS Type, v2.name AS Name + RETURN type(r) AS Type, v2.team.name AS Name """ Then the result should be, in any order, with relax comparison: | Type | Name | @@ -145,7 +145,7 @@ Feature: Match By Id """ MATCH (v1) -[:like]-> (v2) WHERE id(v1) == "Danny Green" - RETURN v1.name AS Name, v2.name AS Friend + RETURN v1.player.name AS Name, v2.player.name AS Friend """ Then the result should be, in any order, with relax comparison: | Name | Friend | @@ -156,7 +156,7 @@ Feature: Match By Id """ MATCH (v1) <-[:like]- (v2) WHERE id(v1) == "Danny Green" - RETURN v1.name AS Name, v2.name AS Friend + RETURN v1.player.name AS Name, v2.player.name AS Friend """ Then the result should be, in any order, with relax comparison: | Name | Friend | @@ -166,7 +166,7 @@ Feature: Match By Id """ MATCH (v1) <-[:like]-> (v2) WHERE id(v1) == "Danny Green" - RETURN v1.name AS Name, v2.name AS Friend + RETURN v1.player.name AS Name, v2.player.name AS Friend """ Then the result should be, in any order, with relax comparison: | Name | Friend | @@ -179,7 +179,7 @@ Feature: Match By Id """ MATCH (v1) -[:like]- (v2) WHERE id(v1) == "Danny Green" - RETURN v1.name AS Name, v2.name AS Friend + RETURN v1.player.name AS Name, v2.player.name AS Friend """ Then the result should be, in any order, with relax comparison: | Name | Friend | @@ -194,7 +194,7 @@ Feature: Match By Id """ MATCH (v1) -[:like]-> (v2) -[:like]-> (v3) WHERE id(v1) == "Tim Duncan" - RETURN v1.name AS Player, v2.name AS Friend, v3.name AS FoF + RETURN v1.player.name AS Player, v2.player.name AS Friend, v3.player.name AS FoF """ Then the result should be, in any order, with relax comparison: | Player | Friend | FoF | @@ -208,7 +208,7 @@ Feature: Match By Id """ MATCH (v1) -[:like]-> () -[:like]-> (v3) WHERE id(v1) == 'Dwyane Wade' - RETURN v3.name AS Name + RETURN v3.player.name AS Name """ Then the result should be, in any order, with relax comparison: | Name | @@ -223,7 +223,7 @@ Feature: Match By Id """ MATCH (v1) -[:like]-> () -[:like]-> (v3) WHERE id(v1) == 'Dwyane Wade' - RETURN DISTINCT v3.name AS Name + RETURN DISTINCT v3.player.name AS Name """ Then the result should be, in any order, with relax comparison: | Name | @@ -238,7 +238,7 @@ Feature: Match By Id """ MATCH (v1) -[:like]-> (v) WHERE id(v1) == 'Dejounte Murray' - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC """ Then the result should be, in any order, with relax comparison: @@ -258,7 +258,7 @@ Feature: Match By Id """ MATCH (v1) -[:like]-> (v) WHERE id(v1) == 'Dejounte Murray' - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC LIMIT 3 """ @@ -271,7 +271,7 @@ Feature: Match By Id """ MATCH (v1) -[:like]-> (v) WHERE id(v1) == 'Dejounte Murray' - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC SKIP 3 """ @@ -289,7 +289,7 @@ Feature: Match By Id """ MATCH (v1) -[:like]-> (v) WHERE id(v1) == 'Dejounte Murray' - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC SKIP 3 LIMIT 3 @@ -303,7 +303,7 @@ Feature: Match By Id """ MATCH (v1) -[:like]-> (v) WHERE id(v1) == 'Dejounte Murray' - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC SKIP 11 LIMIT 3 @@ -314,7 +314,7 @@ Feature: Match By Id """ MATCH (v1) -[:like]-> (v) WHERE id(v1) == 'Dejounte Murray' - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age ORDER BY Age DESC, Name ASC LIMIT 0 """ @@ -324,8 +324,8 @@ Feature: Match By Id """ MATCH (v1) -[:like]-> (v) WHERE id(v1) == 'Dejounte Murray' - RETURN v.name AS Name, v.age AS Age - ORDER BY v.age DESC, v.name ASC + RETURN v.player.name AS Name, v.player.age AS Age + ORDER BY v.player.age DESC, v.player.name ASC LIMIT 0 """ Then a SemanticError should be raised at runtime: Only column name can be used as sort item @@ -344,19 +344,19 @@ Feature: Match By Id """ MATCH p = (n)-[:like]->(m) WHERE id(n) == "LeBron James" - RETURN p, n.name, m.name + RETURN p, n.player.name, m.player.name """ Then the result should be, in any order, with relax comparison: - | p | n.name | m.name | - | <("LeBron James")-[:like]->("Ray Allen")> | "LeBron James" | "Ray Allen" | + | p | n.player.name | m.player.name | + | <("LeBron James")-[:like]->("Ray Allen")> | "LeBron James" | "Ray Allen" | When executing query: """ MATCH p = (n)<-[:like]-(m) WHERE id(n) == "LeBron James" - RETURN p, n.name, m.name + RETURN p, n.player.name, m.player.name """ Then the result should be, in any order, with relax comparison: - | p | n.name | m.name | + | p | n.player.name | m.player.name | | <("LeBron James")<-[:like]-("Carmelo Anthony")> | "LeBron James" | "Carmelo Anthony" | | <("LeBron James")<-[:like]-("Chris Paul")> | "LeBron James" | "Chris Paul" | | <("LeBron James")<-[:like]-("Danny Green")> | "LeBron James" | "Danny Green" | @@ -367,10 +367,10 @@ Feature: Match By Id """ MATCH p = (n)-[:like]-(m) WHERE id(n) == "LeBron James" - RETURN p, n.name, m.name + RETURN p, n.player.name, m.player.name """ Then the result should be, in any order, with relax comparison: - | p | n.name | m.name | + | p | n.player.name | m.player.name | | <("LeBron James")<-[:like]-("Carmelo Anthony")> | "LeBron James" | "Carmelo Anthony" | | <("LeBron James")<-[:like]-("Chris Paul")> | "LeBron James" | "Chris Paul" | | <("LeBron James")<-[:like]-("Danny Green")> | "LeBron James" | "Danny Green" | @@ -382,11 +382,11 @@ Feature: Match By Id """ MATCH p = (n)-[:like]->(m)-[:like]->(k) WHERE id(n) == "LeBron James" - RETURN p, n.name, m.name, k.name + RETURN p, n.player.name, m.player.name, k.player.name """ Then the result should be, in any order, with relax comparison: - | p | n.name | m.name | k.name | - | <("LeBron James")-[:like]->("Ray Allen")-[:like]->("Rajon Rondo")> | "LeBron James" | "Ray Allen" | "Rajon Rondo" | + | p | n.player.name | m.player.name | k.player.name | + | <("LeBron James")-[:like]->("Ray Allen")-[:like]->("Rajon Rondo")> | "LeBron James" | "Ray Allen" | "Rajon Rondo" | When executing query: """ MATCH p = (n)-[:like]->()-[:like]->() diff --git a/tests/tck/features/match/MatchGroupBy.feature b/tests/tck/features/match/MatchGroupBy.feature index eba71416d6d..6fe3ae0c320 100644 --- a/tests/tck/features/match/MatchGroupBy.feature +++ b/tests/tck/features/match/MatchGroupBy.feature @@ -12,10 +12,10 @@ Feature: Match GroupBy MATCH(n:player) RETURN id(n) AS id, count(n) AS count, - sum(floor(n.age)) AS sum, - max(n.age) AS max, - min(n.age) AS min, - avg(distinct n.age) AS age, + sum(floor(n.player.age)) AS sum, + max(n.player.age) AS max, + min(n.player.age) AS min, + avg(distinct n.player.age) AS age, labels(n) AS lb ORDER BY id, count, max, min SKIP 10 LIMIT 8; @@ -37,10 +37,10 @@ Feature: Match GroupBy MATCH(n:player) RETURN id(n) AS id, count(n) AS count, - sum(floor(n.age)) AS sum, - max(n.age) AS max, - min(n.age) AS min, - avg(distinct n.age)+1 AS age, + sum(floor(n.player.age)) AS sum, + max(n.player.age) AS max, + min(n.player.age) AS min, + avg(distinct n.player.age)+1 AS age, labels(n) AS lb ORDER BY id, count, max, min SKIP 10 LIMIT 8; @@ -62,10 +62,10 @@ Feature: Match GroupBy MATCH(n:player) RETURN id(n) AS id, count(n) AS count, - sum(floor(n.age)) AS sum, - max(n.age) AS max, - min(n.age) AS min, - (INT)avg(distinct n.age)+1 AS age, + sum(floor(n.player.age)) AS sum, + max(n.player.age) AS max, + min(n.player.age) AS min, + (INT)avg(distinct n.player.age)+1 AS age, labels(n) AS lb ORDER BY id, count, max, min SKIP 10 LIMIT 8; @@ -85,13 +85,13 @@ Feature: Match GroupBy When executing query: """ MATCH(n:player) - WHERE n.age > 35 + WHERE n.player.age > 35 RETURN DISTINCT id(n) AS id, count(n) AS count, - sum(floor(n.age)) AS sum, - max(n.age) AS max, - min(n.age) AS min, - avg(distinct n.age)+1 AS age, + sum(floor(n.player.age)) AS sum, + max(n.player.age) AS max, + min(n.player.age) AS min, + avg(distinct n.player.age)+1 AS age, labels(n) AS lb ORDER BY id, count, max, min SKIP 10 LIMIT 6; @@ -109,13 +109,13 @@ Feature: Match GroupBy When executing query: """ MATCH(n:player)-[:like]->(m) - WHERE n.age > 35 + WHERE n.player.age > 35 RETURN DISTINCT id(n) AS id, count(n) AS count, - sum(floor(n.age)) AS sum, - max(m.age) AS max, - min(n.age) AS min, - avg(distinct n.age)+1 AS age, + sum(floor(n.player.age)) AS sum, + max(m.player.age) AS max, + min(n.player.age) AS min, + avg(distinct n.player.age)+1 AS age, labels(m) AS lb ORDER BY id, count, max, min SKIP 10 LIMIT 20; @@ -136,13 +136,13 @@ Feature: Match GroupBy When executing query: """ MATCH(n:player)-[:like*2]->(m)-[:serve]->() - WHERE n.age > 35 + WHERE n.player.age > 35 WITH DISTINCT id(n) AS id, count(n) AS count, - sum(floor(n.age)) AS sum, - max(m.age) AS max, - min(n.age) AS min, - avg(distinct n.age)+1 AS age, + sum(floor(n.player.age)) AS sum, + max(m.player.age) AS max, + min(n.player.age) AS min, + avg(distinct n.player.age)+1 AS age, labels(m) AS lb ORDER BY id, count, max, min RETURN count(*) AS count; @@ -155,13 +155,13 @@ Feature: Match GroupBy When executing query: """ MATCH(n:player)-[:like*2]->(m)-[:serve]->() - WHERE n.age > 35 + WHERE n.player.age > 35 WITH DISTINCT id(n) AS id, count(n) AS count, - sum(floor(n.age)) AS sum, - max(m.age) AS max, - min(n.age) AS min, - avg(distinct n.age)+1 AS age, + sum(floor(n.player.age)) AS sum, + max(m.player.age) AS max, + min(n.player.age) AS min, + avg(distinct n.player.age)+1 AS age, labels(m) AS lb ORDER BY id, count, max, min RETURN DISTINCT min, (INT)count(*) AS count; @@ -186,7 +186,7 @@ Feature: Match GroupBy MATCH p = (a:player)-[:like]->(other:player) WHERE other <> a WITH a AS a, other AS other, length(p) AS len - RETURN a.name AS name, (INT)avg(other.age) AS age, len + RETURN a.player.name AS name, (INT)avg(other.player.age) AS age, len ORDER BY name, age SKIP 3 LIMIT 8 """ diff --git a/tests/tck/features/match/MultiQueryParts.feature b/tests/tck/features/match/MultiQueryParts.feature index 63d73327f1b..7e989932b22 100644 --- a/tests/tck/features/match/MultiQueryParts.feature +++ b/tests/tck/features/match/MultiQueryParts.feature @@ -10,7 +10,9 @@ Feature: Multi Query Parts When executing query: """ MATCH (m)-[]-(n), (n)-[]-(l) WHERE id(m)=="Tim Duncan" - RETURN m.name AS n1, n.name AS n2, l.name AS n3 ORDER BY n1, n2, n3 LIMIT 10 + RETURN m.player.name AS n1, n.player.name AS n2, + CASE WHEN l.team.name is not null THEN l.team.name + WHEN l.player.name is not null THEN l.player.name ELSE "null" END AS n3 ORDER BY n1, n2, n3 LIMIT 10 """ Then the result should be, in order: | n1 | n2 | n3 | @@ -27,7 +29,9 @@ Feature: Multi Query Parts When executing query: """ MATCH (m)-[]-(n), (l)-[]-(n) WHERE id(m)=="Tim Duncan" - RETURN m.name AS n1, n.name AS n2, l.name AS n3 ORDER BY n1, n2, n3 LIMIT 10 + RETURN m.player.name AS n1, n.player.name AS n2, + CASE WHEN l.team.name is not null THEN l.team.name + WHEN l.player.name is not null THEN l.player.name ELSE "null" END AS n3 ORDER BY n1, n2, n3 LIMIT 10 """ Then the result should be, in order: | n1 | n2 | n3 | @@ -44,7 +48,7 @@ Feature: Multi Query Parts When executing query: """ MATCH (m)-[]-(n), (n)-[]-(l) WHERE id(n)=="Tim Duncan" - RETURN m.name AS n1, n.name AS n2, l.name AS n3 ORDER BY n1, n2, n3 LIMIT 10 + RETURN m.player.name AS n1, n.player.name AS n2, l.player.name AS n3 ORDER BY n1, n2, n3 LIMIT 10 """ Then the result should be, in order: | n1 | n2 | n3 | @@ -61,7 +65,7 @@ Feature: Multi Query Parts When executing query: """ MATCH (m)-[]-(n), (n)-[]-(l), (l)-[]-(h) WHERE id(m)=="Tim Duncan" - RETURN m.name AS n1, n.name AS n2, l.name AS n3, h.name AS n4 + RETURN m.player.name AS n1, n.player.name AS n2, l.team.name AS n3, h.player.name AS n4 ORDER BY n1, n2, n3, n4 LIMIT 10 """ Then the result should be, in order: @@ -89,7 +93,9 @@ Feature: Multi Query Parts """ MATCH (m)-[]-(n) WHERE id(m)=="Tim Duncan" MATCH (n)-[]-(l) - RETURN m.name AS n1, n.name AS n2, l.name AS n3 ORDER BY n1, n2, n3 LIMIT 10 + RETURN m.player.name AS n1, n.player.name AS n2, + CASE WHEN l.player.name is not null THEN l.player.name + WHEN l.team.name is not null THEN l.team.name ELSE "null" END AS n3 ORDER BY n1, n2, n3 LIMIT 10 """ Then the result should be, in order: | n1 | n2 | n3 | @@ -107,7 +113,7 @@ Feature: Multi Query Parts """ MATCH (m)-[]-(n) WHERE id(m)=="Tim Duncan" MATCH (n)-[]-(l), (l)-[]-(h) - RETURN m.name AS n1, n.name AS n2, l.name AS n3, h.name AS n4 + RETURN m.player.name AS n1, n.player.name AS n2, l.team.name AS n3, h.player.name AS n4 ORDER BY n1, n2, n3, n4 LIMIT 10 """ Then the result should be, in order: @@ -127,7 +133,7 @@ Feature: Multi Query Parts MATCH (m)-[]-(n) WHERE id(m)=="Tim Duncan" MATCH (n)-[]-(l) MATCH (l)-[]-(h) - RETURN m.name AS n1, n.name AS n2, l.name AS n3, h.name AS n4 + RETURN m.player.name AS n1, n.player.name AS n2, l.team.name AS n3, h.player.name AS n4 ORDER BY n1, n2, n3, n4 LIMIT 10 """ Then the result should be, in order: @@ -148,7 +154,7 @@ Feature: Multi Query Parts """ MATCH (m)-[]-(n) WHERE id(m)=="Tim Duncan" OPTIONAL MATCH (n)<-[:serve]-(l) - RETURN m.name AS n1, n.name AS n2, l AS n3 ORDER BY n1, n2, n3 LIMIT 10 + RETURN m.player.name AS n1, n.player.name AS n2, l AS n3 ORDER BY n1, n2, n3 LIMIT 10 """ Then the result should be, in order: | n1 | n2 | n3 | @@ -167,7 +173,7 @@ Feature: Multi Query Parts """ MATCH (m)-[]-(n) WHERE id(m)=="Tim Duncan" OPTIONAL MATCH (a)<-[]-(b) - RETURN m.name AS n1, n.name AS n2, a.name AS n3 ORDER BY n1, n2, n3 LIMIT 10 + RETURN m.player.name AS n1, n.player.name AS n2, a.player.name AS n3 ORDER BY n1, n2, n3 LIMIT 10 """ Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. @@ -175,9 +181,11 @@ Feature: Multi Query Parts When executing query: """ MATCH (m)-[]-(n) WHERE id(m)=="Tim Duncan" - WITH n, n.name AS n1 ORDER BY n1 LIMIT 10 + WITH n, n.player.name AS n1 ORDER BY n1 LIMIT 10 MATCH (n)-[]-(l) - RETURN n.name AS n1, l.name AS n2 ORDER BY n1, n2 LIMIT 10 + RETURN n.player.name AS n1, + CASE WHEN l.player.name is not null THEN l.player.name + WHEN l.team.name is not null THEN l.team.name ELSE "null" END AS n2 ORDER BY n1, n2 LIMIT 10 """ Then the result should be, in order: | n1 | n2 | @@ -215,9 +223,9 @@ Feature: Multi Query Parts When executing query: """ MATCH (m)-[]-(n) WHERE id(m)=="Tim Duncan" - WITH n, n.name AS n1 ORDER BY n1 LIMIT 10 + WITH n, n.player.name AS n1 ORDER BY n1 LIMIT 10 MATCH (a)-[]-(b) - RETURN a.name AS n1, b.name AS n2 ORDER BY n1, n2 LIMIT 10 + RETURN a.player.name AS n1, b.player.name AS n2 ORDER BY n1, n2 LIMIT 10 """ Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. @@ -225,7 +233,7 @@ Feature: Multi Query Parts When executing query: """ MATCH (m)-[]-(n) WHERE id(m)=="Tim Duncan" - WITH n, n.name AS n1 ORDER BY n1 LIMIT 10 + WITH n, n.player.name AS n1 ORDER BY n1 LIMIT 10 RETURN m """ Then a SemanticError should be raised at runtime: Alias used but not defined: `m' diff --git a/tests/tck/features/match/SameTagPropname.feature b/tests/tck/features/match/SameTagPropname.feature new file mode 100644 index 00000000000..458a9a5f76c --- /dev/null +++ b/tests/tck/features/match/SameTagPropname.feature @@ -0,0 +1,214 @@ +# Copyright (c) 2021 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License. +Feature: Same Tag Propname + + Background: + Given an empty graph + And create a space with following options: + | partition_num | 9 | + | replica_factor | 1 | + | vid_type | FIXED_STRING(32) | + + Scenario: same tag propname + Given having executed: + """ + CREATE TAG student(name string, age int, score float); + CREATE TAG player(name string, age int, height float); + CREATE EDGE like(likeness int); + CREATE TAG INDEX s_age_index ON student(age); + CREATE TAG INDEX s_name_index ON student(name(20)); + CREATE TAG INDEX s_score_index ON student(score); + CREATE TAG INDEX p_name_index ON player(name(20)); + CREATE TAG INDEX p_age_index ON player(age); + CREATE TAG INDEX p_height_index ON player(height); + CREATE EDGE INDEX like_likeness_index ON like(likeness); + """ + And wait 6 seconds + When executing query: + """ + INSERT VERTEX + student(name, age, score) + VALUES + "zhang":("s_zhang", 18, 89), + "wang": ("s_wang", 22, 82), + "li": ("s_li", 20, 91), + "zhao": ("s_zhao", 20, 99), + "qian": ("s_qian", 19, 88), + "sun": ("s_sun", 17, 72 ); + INSERT VERTEX + player(name, age, height) + VALUES + "zhang":("p_zhang", 18, 189), + "wang": ("p_wang", 22, 192), + "li": ("p_li", 20, 201), + "zhao": ("p_zhao", 20, 187), + "qian": ("p_qian", 19, 179), + "sun": ("p_sun", 17, 192); + """ + Then the execution should be successful + When executing query: + """ + INSERT EDGE + like(likeness) + VALUES + "zhang"->"wang":(98), + "zhang"->"li":(89), + "zhang"->"zhao":(99), + "zhang"->"sun":(78), + "zhao"->"sun":(29), + "zhao"->"wang":(89), + "zhao"->"li":(99), + "zhao"->"qian":(100), + "li"->"sun":(99), + "li"->"qian":(89), + "qian"->"zhang":(20), + "qian"->"wang":(79), + "sun"->"li":(93), + "sun"->"wang":(95), + "wang"->"li":(74), + "wang"->"zhang":(91); + """ + Then the execution should be successful + When executing query: + """ + match (v:player) return v.player.name, v + """ + Then the result should be, in any order: + | v.player.name | v | + | "p_qian" | ("qian" :player{age: 19, height: 179.0, name: "p_qian"} :student{age: 19, name: "s_qian", score: 88.0}) | + | "p_zhao" | ("zhao" :player{age: 20, height: 187.0, name: "p_zhao"} :student{age: 20, name: "s_zhao", score: 99.0}) | + | "p_wang" | ("wang" :player{age: 22, height: 192.0, name: "p_wang"} :student{age: 22, name: "s_wang", score: 82.0}) | + | "p_li" | ("li" :player{age: 20, height: 201.0, name: "p_li"} :student{age: 20, name: "s_li", score: 91.0}) | + | "p_zhang" | ("zhang" :player{age: 18, height: 189.0, name: "p_zhang"} :student{age: 18, name: "s_zhang", score: 89.0}) | + | "p_sun" | ("sun" :player{age: 17, height: 192.0, name: "p_sun"} :student{age: 17, name: "s_sun", score: 72.0}) | + When executing query: + """ + match (v:player) where v.player.age > 20 return v.player.name, v + """ + Then the result should be, in any order: + | v.player.name | v | + | "p_wang" | ("wang" :player{age: 22, height: 192.0, name: "p_wang"} :student{age: 22, name: "s_wang", score: 82.0}) | + When executing query: + """ + match (v:student) return v.student.name, v + """ + Then the result should be, in any order: + | v.student.name | v | + | "s_qian" | ("qian" :player{age: 19, height: 179.0, name: "p_qian"} :student{age: 19, name: "s_qian", score: 88.0}) | + | "s_zhao" | ("zhao" :player{age: 20, height: 187.0, name: "p_zhao"} :student{age: 20, name: "s_zhao", score: 99.0}) | + | "s_wang" | ("wang" :player{age: 22, height: 192.0, name: "p_wang"} :student{age: 22, name: "s_wang", score: 82.0}) | + | "s_li" | ("li" :player{age: 20, height: 201.0, name: "p_li"} :student{age: 20, name: "s_li", score: 91.0}) | + | "s_zhang" | ("zhang" :player{age: 18, height: 189.0, name: "p_zhang"} :student{age: 18, name: "s_zhang", score: 89.0}) | + | "s_sun" | ("sun" :player{age: 17, height: 192.0, name: "p_sun"} :student{age: 17, name: "s_sun", score: 72.0}) | + When executing query: + """ + match (v:student) where v.student.age > 20 return v.student.name, v + """ + Then the result should be, in any order: + | v.student.name | v | + | "s_wang" | ("wang" :player{age: 22, height: 192.0, name: "p_wang"} :student{age: 22, name: "s_wang", score: 82.0}) | + When executing query: + """ + match (v:player)-[e:like]->(d) where v.player.age > 19 return e, v.student.name, v.player.name + """ + Then the result should be, in any order: + | e | v.student.name | v.player.name | + | [:like "li"->"sun" @0 {likeness: 99}] | "s_li" | "p_li" | + | [:like "li"->"qian" @0 {likeness: 89}] | "s_li" | "p_li" | + | [:like "zhao"->"li" @0 {likeness: 99}] | "s_zhao" | "p_zhao" | + | [:like "zhao"->"qian" @0 {likeness: 100}] | "s_zhao" | "p_zhao" | + | [:like "zhao"->"sun" @0 {likeness: 29}] | "s_zhao" | "p_zhao" | + | [:like "zhao"->"wang" @0 {likeness: 89}] | "s_zhao" | "p_zhao" | + | [:like "wang"->"li" @0 {likeness: 74}] | "s_wang" | "p_wang" | + | [:like "wang"->"zhang" @0 {likeness: 91}] | "s_wang" | "p_wang" | + When executing query: + """ + match (v:player)-[e:like]->(d) where e.likeness > 85 return e, v.student.name, v.player.name + """ + Then the result should be, in any order: + | e | v.student.name | v.player.name | + | [:like "zhang"->"li" @0 {likeness: 89}] | "s_zhang" | "p_zhang" | + | [:like "li"->"sun" @0 {likeness: 99}] | "s_li" | "p_li" | + | [:like "zhang"->"wang" @0 {likeness: 98}] | "s_zhang" | "p_zhang" | + | [:like "zhang"->"zhao" @0 {likeness: 99}] | "s_zhang" | "p_zhang" | + | [:like "sun"->"li" @0 {likeness: 93}] | "s_sun" | "p_sun" | + | [:like "sun"->"wang" @0 {likeness: 95}] | "s_sun" | "p_sun" | + | [:like "li"->"qian" @0 {likeness: 89}] | "s_li" | "p_li" | + | [:like "wang"->"zhang" @0 {likeness: 91}] | "s_wang" | "p_wang" | + | [:like "zhao"->"li" @0 {likeness: 99}] | "s_zhao" | "p_zhao" | + | [:like "zhao"->"qian" @0 {likeness: 100}] | "s_zhao" | "p_zhao" | + | [:like "zhao"->"wang" @0 {likeness: 89}] | "s_zhao" | "p_zhao" | + When executing query: + """ + match (v:player) where v.student.score > 80 return v.student.name, v.player.height, v + """ + Then the result should be, in any order: + | v.student.name | v.player.height | v | + | "s_qian" | 179.0 | ("qian" :player{age: 19, height: 179.0, name: "p_qian"} :student{age: 19, name: "s_qian", score: 88.0}) | + | "s_zhao" | 187.0 | ("zhao" :player{age: 20, height: 187.0, name: "p_zhao"} :student{age: 20, name: "s_zhao", score: 99.0}) | + | "s_wang" | 192.0 | ("wang" :player{age: 22, height: 192.0, name: "p_wang"} :student{age: 22, name: "s_wang", score: 82.0}) | + | "s_li" | 201.0 | ("li" :player{age: 20, height: 201.0, name: "p_li"} :student{age: 20, name: "s_li", score: 91.0}) | + | "s_zhang" | 189.0 | ("zhang" :player{age: 18, height: 189.0, name: "p_zhang"} :student{age: 18, name: "s_zhang", score: 89.0}) | + When executing query: + """ + match (v:student {age:20}) where v.player.height > 190 return v + """ + Then the result should be, in any order: + | v | + | ("li" :player{age: 20, height: 201.0, name: "p_li"} :student{age: 20, name: "s_li", score: 91.0}) | + When executing query: + """ + match p= (v:player)-[e:like*1..2]->(d) where v.player.age > 20 return p + """ + Then the result should be, in any order: + | p | + | <("wang" :player{age: 22, height: 192.0, name: "p_wang"} :student{age: 22, name: "s_wang", score: 82.0})-[:like@0 {likeness: 91}]->("zhang" :player{age: 18, height: 189.0, name: "p_zhang"} :student{age: 18, name: "s_zhang", score: 89.0})-[:like@0 {likeness: 99}]->("zhao" :player{age: 20, height: 187.0, name: "p_zhao"} :student{age: 20, name: "s_zhao", score: 99.0})> | + | <("wang" :player{age: 22, height: 192.0, name: "p_wang"} :student{age: 22, name: "s_wang", score: 82.0})-[:like@0 {likeness: 91}]->("zhang" :player{age: 18, height: 189.0, name: "p_zhang"} :student{age: 18, name: "s_zhang", score: 89.0})-[:like@0 {likeness: 98}]->("wang" :player{age: 22, height: 192.0, name: "p_wang"} :student{age: 22, name: "s_wang", score: 82.0})> | + | <("wang" :player{age: 22, height: 192.0, name: "p_wang"} :student{age: 22, name: "s_wang", score: 82.0})-[:like@0 {likeness: 91}]->("zhang" :player{age: 18, height: 189.0, name: "p_zhang"} :student{age: 18, name: "s_zhang", score: 89.0})-[:like@0 {likeness: 78}]->("sun" :player{age: 17, height: 192.0, name: "p_sun"} :student{age: 17, name: "s_sun", score: 72.0})> | + | <("wang" :player{age: 22, height: 192.0, name: "p_wang"} :student{age: 22, name: "s_wang", score: 82.0})-[:like@0 {likeness: 91}]->("zhang" :player{age: 18, height: 189.0, name: "p_zhang"} :student{age: 18, name: "s_zhang", score: 89.0})-[:like@0 {likeness: 89}]->("li" :player{age: 20, height: 201.0, name: "p_li"} :student{age: 20, name: "s_li", score: 91.0})> | + | <("wang" :player{age: 22, height: 192.0, name: "p_wang"} :student{age: 22, name: "s_wang", score: 82.0})-[:like@0 {likeness: 74}]->("li" :player{age: 20, height: 201.0, name: "p_li"} :student{age: 20, name: "s_li", score: 91.0})-[:like@0 {likeness: 99}]->("sun" :player{age: 17, height: 192.0, name: "p_sun"} :student{age: 17, name: "s_sun", score: 72.0})> | + | <("wang" :player{age: 22, height: 192.0, name: "p_wang"} :student{age: 22, name: "s_wang", score: 82.0})-[:like@0 {likeness: 74}]->("li" :player{age: 20, height: 201.0, name: "p_li"} :student{age: 20, name: "s_li", score: 91.0})-[:like@0 {likeness: 89}]->("qian" :player{age: 19, height: 179.0, name: "p_qian"} :student{age: 19, name: "s_qian", score: 88.0})> | + | <("wang" :player{age: 22, height: 192.0, name: "p_wang"} :student{age: 22, name: "s_wang", score: 82.0})-[:like@0 {likeness: 74}]->("li" :player{age: 20, height: 201.0, name: "p_li"} :student{age: 20, name: "s_li", score: 91.0})> | + | <("wang" :player{age: 22, height: 192.0, name: "p_wang"} :student{age: 22, name: "s_wang", score: 82.0})-[:like@0 {likeness: 91}]->("zhang" :player{age: 18, height: 189.0, name: "p_zhang"} :student{age: 18, name: "s_zhang", score: 89.0})> | + When executing query: + """ + match p= (v:player)-[e:like*1..2]->(d) where v.player.age > 20 return e + """ + Then the result should be, in any order: + | e | + | [[:like "wang"->"zhang" @0 {likeness: 91}], [:like "zhang"->"zhao" @0 {likeness: 99}]] | + | [[:like "wang"->"zhang" @0 {likeness: 91}], [:like "zhang"->"wang" @0 {likeness: 98}]] | + | [[:like "wang"->"zhang" @0 {likeness: 91}], [:like "zhang"->"sun" @0 {likeness: 78}]] | + | [[:like "wang"->"zhang" @0 {likeness: 91}], [:like "zhang"->"li" @0 {likeness: 89}]] | + | [[:like "wang"->"li" @0 {likeness: 74}], [:like "li"->"sun" @0 {likeness: 99}]] | + | [[:like "wang"->"li" @0 {likeness: 74}], [:like "li"->"qian" @0 {likeness: 89}]] | + | [[:like "wang"->"li" @0 {likeness: 74}]] | + | [[:like "wang"->"zhang" @0 {likeness: 91}]] | + When executing query: + """ + match p= (v:player)-[e:like]->(d) where v.student.age > 19 return v.student.score, v.student.name, v.player.name + """ + Then the result should be, in any order: + | v.student.score | v.student.name | v.player.name | + | 91.0 | "s_li" | "p_li" | + | 91.0 | "s_li" | "p_li" | + | 99.0 | "s_zhao" | "p_zhao" | + | 99.0 | "s_zhao" | "p_zhao" | + | 99.0 | "s_zhao" | "p_zhao" | + | 99.0 | "s_zhao" | "p_zhao" | + | 82.0 | "s_wang" | "p_wang" | + | 82.0 | "s_wang" | "p_wang" | + When executing query: + """ + match (v:player) where v.student.height > 190 return v + """ + Then the result should be, in any order: + | v | + When executing query: + """ + match (v:player) where v.abc.height > 190 return v.player.name + """ + Then the result should be, in any order: + | v.player.name | + Then drop the used space diff --git a/tests/tck/features/match/Scan.feature b/tests/tck/features/match/Scan.feature index 4c3a8430299..3937e5ea91c 100644 --- a/tests/tck/features/match/Scan.feature +++ b/tests/tck/features/match/Scan.feature @@ -10,7 +10,7 @@ Feature: Match seek by scan When executing query: """ MATCH (v) - RETURN v.name AS Name + RETURN v.student.name AS Name LIMIT 3 """ Then the result should be, in any order: @@ -21,7 +21,7 @@ Feature: Match seek by scan When executing query: """ MATCH (v:teacher) - RETURN v.name AS Name + RETURN v.teacher.name AS Name LIMIT 3 """ Then the result should be, in any order: @@ -52,7 +52,7 @@ Feature: Match seek by scan When executing query: """ MATCH (v:teacher:student) - RETURN v.name AS Name + RETURN v.student.name AS Name LIMIT 3 """ Then the result should be, in any order: @@ -60,7 +60,7 @@ Feature: Match seek by scan When executing query: """ MATCH (v:person:teacher) - RETURN v.name AS Name + RETURN v.person.name AS Name LIMIT 3 """ Then the result should be, in any order: @@ -71,7 +71,7 @@ Feature: Match seek by scan When executing query: """ MATCH (v:person{name: "Mary"}:teacher) - RETURN v.name AS Name + RETURN v.person.name AS Name LIMIT 3 """ Then the result should be, in any order: @@ -82,13 +82,13 @@ Feature: Match seek by scan When executing query: """ MATCH (v) - RETURN v.name AS Name + RETURN v.person.name AS Name """ Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. When executing query: """ MATCH (v{name: "Mary"}) - RETURN v.name AS Name + RETURN v.student.name AS Name LIMIT 3 """ Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. @@ -151,7 +151,7 @@ Feature: Match seek by scan When executing query: """ MATCH (v)-[e]->() - RETURN v.name, type(e) AS Type + RETURN v.person.name, type(e) AS Type LIMIT 3 """ Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. diff --git a/tests/tck/features/match/SeekByEdge.feature b/tests/tck/features/match/SeekByEdge.feature index 4e91b88ec65..a333e520d94 100644 --- a/tests/tck/features/match/SeekByEdge.feature +++ b/tests/tck/features/match/SeekByEdge.feature @@ -11,10 +11,10 @@ Feature: Match seek by edge When executing query: """ MATCH (player)-[:serve]->(team) - RETURN player.name, team.name + RETURN player.player.name, team.team.name """ Then the result should be, in any order: - | player.name | team.name | + | player.player.name | team.team.name | | "Amar'e Stoudemire" | "Suns" | | "Amar'e Stoudemire" | "Knicks" | | "Amar'e Stoudemire" | "Heat" | @@ -170,10 +170,10 @@ Feature: Match seek by edge When executing query: """ MATCH (team)<-[:serve]-(player) - RETURN player.name, team.name + RETURN player.player.name, team.team.name """ Then the result should be, in any order: - | player.name | team.name | + | player.player.name | team.team.name | | "Amar'e Stoudemire" | "Suns" | | "Amar'e Stoudemire" | "Knicks" | | "Amar'e Stoudemire" | "Heat" | @@ -329,321 +329,321 @@ Feature: Match seek by edge When executing query: """ MATCH (team)-[:serve]-(player) - RETURN player.name, team.name + RETURN player.player.name, team.team.name """ Then the result should be, in any order: - | player.name | team.name | - | "Heat" | "Amar'e Stoudemire" | - | "Suns" | "Amar'e Stoudemire" | - | "Knicks" | "Amar'e Stoudemire" | - | "Thunders" | "Russell Westbrook" | - | "Rockets" | "James Harden" | - | "Thunders" | "James Harden" | - | "Lakers" | "Kobe Bryant" | - | "Rockets" | "Tracy McGrady" | - | "Spurs" | "Tracy McGrady" | - | "Magic" | "Tracy McGrady" | - | "Raptors" | "Tracy McGrady" | - | "Hornets" | "Chris Paul" | - | "Rockets" | "Chris Paul" | - | "Clippers" | "Chris Paul" | - | "Spurs" | "Boris Diaw" | - | "Hornets" | "Boris Diaw" | - | "Hawks" | "Boris Diaw" | - | "Jazz" | "Boris Diaw" | - | "Suns" | "Boris Diaw" | - | "Heat" | "LeBron James" | - | "Cavaliers" | "LeBron James" | - | "Cavaliers" | "LeBron James" | - | "Lakers" | "LeBron James" | - | "Warriors" | "Klay Thompson" | - | "Knicks" | "Kristaps Porzingis" | - | "Mavericks" | "Kristaps Porzingis" | - | "Magic" | "Jonathon Simmons" | - | "76ers" | "Jonathon Simmons" | - | "Spurs" | "Jonathon Simmons" | - | "Kings" | "Marco Belinelli" | - | "Warriors" | "Marco Belinelli" | - | "Raptors" | "Marco Belinelli" | - | "Hornets" | "Marco Belinelli" | - | "Spurs" | "Marco Belinelli" | - | "76ers" | "Marco Belinelli" | - | "Hawks" | "Marco Belinelli" | - | "Hornets" | "Marco Belinelli" | - | "Spurs" | "Marco Belinelli" | - | "Bulls" | "Marco Belinelli" | - | "Mavericks" | "Luka Doncic" | - | "Hornets" | "David West" | - | "Warriors" | "David West" | - | "Pacers" | "David West" | - | "Spurs" | "David West" | - | "Spurs" | "Tony Parker" | - | "Hornets" | "Tony Parker" | - | "Raptors" | "Danny Green" | - | "Cavaliers" | "Danny Green" | - | "Spurs" | "Danny Green" | - | "Grizzlies" | "Rudy Gay" | - | "Kings" | "Rudy Gay" | - | "Spurs" | "Rudy Gay" | - | "Raptors" | "Rudy Gay" | - | "Spurs" | "LaMarcus Aldridge" | - | "Trail Blazers" | "LaMarcus Aldridge" | - | "Spurs" | "Tim Duncan" | - | "Thunders" | "Kevin Durant" | - | "Warriors" | "Kevin Durant" | - | "Warriors" | "Stephen Curry" | - | "Bucks" | "Ray Allen" | - | "Thunders" | "Ray Allen" | - | "Heat" | "Ray Allen" | - | "Celtics" | "Ray Allen" | - | "76ers" | "Tiago Splitter" | - | "Spurs" | "Tiago Splitter" | - | "Hawks" | "Tiago Splitter" | - | "Clippers" | "DeAndre Jordan" | - | "Mavericks" | "DeAndre Jordan" | - | "Knicks" | "DeAndre Jordan" | - | "Bucks" | "Paul Gasol" | - | "Spurs" | "Paul Gasol" | - | "Grizzlies" | "Paul Gasol" | - | "Bulls" | "Paul Gasol" | - | "Lakers" | "Paul Gasol" | - | "Celtics" | "Aron Baynes" | - | "Pistons" | "Aron Baynes" | - | "Spurs" | "Aron Baynes" | - | "Spurs" | "Cory Joseph" | - | "Raptors" | "Cory Joseph" | - | "Pacers" | "Cory Joseph" | - | "Nets" | "Vince Carter" | - | "Grizzlies" | "Vince Carter" | - | "Raptors" | "Vince Carter" | - | "Hawks" | "Vince Carter" | - | "Suns" | "Vince Carter" | - | "Mavericks" | "Vince Carter" | - | "Magic" | "Vince Carter" | - | "Kings" | "Vince Carter" | - | "Raptors" | "Marc Gasol" | - | "Grizzlies" | "Marc Gasol" | - | "Jazz" | "Ricky Rubio" | - | "Timberwolves" | "Ricky Rubio" | - | "76ers" | "Ben Simmons" | - | "Bucks" | "Giannis Antetokounmpo" | - | "Bulls" | "Rajon Rondo" | - | "Kings" | "Rajon Rondo" | - | "Mavericks" | "Rajon Rondo" | - | "Lakers" | "Rajon Rondo" | - | "Celtics" | "Rajon Rondo" | - | "Pelicans" | "Rajon Rondo" | - | "Spurs" | "Manu Ginobili" | - | "Cavaliers" | "Kyrie Irving" | - | "Celtics" | "Kyrie Irving" | - | "Rockets" | "Carmelo Anthony" | - | "Thunders" | "Carmelo Anthony" | - | "Nuggets" | "Carmelo Anthony" | - | "Knicks" | "Carmelo Anthony" | - | "Bulls" | "Dwyane Wade" | - | "Heat" | "Dwyane Wade" | - | "Cavaliers" | "Dwyane Wade" | - | "Heat" | "Dwyane Wade" | - | "76ers" | "Joel Embiid" | - | "Trail Blazers" | "Damian Lillard" | - | "Rockets" | "Yao Ming" | - | "Spurs" | "Kyle Anderson" | - | "Grizzlies" | "Kyle Anderson" | - | "Spurs" | "Dejounte Murray" | - | "Clippers" | "Blake Griffin" | - | "Pistons" | "Blake Griffin" | - | "Suns" | "Steve Nash" | - | "Suns" | "Steve Nash" | - | "Mavericks" | "Steve Nash" | - | "Lakers" | "Steve Nash" | - | "Mavericks" | "Jason Kidd" | - | "Mavericks" | "Jason Kidd" | - | "Nets" | "Jason Kidd" | - | "Knicks" | "Jason Kidd" | - | "Suns" | "Jason Kidd" | - | "Mavericks" | "Dirk Nowitzki" | - | "Thunders" | "Paul George" | - | "Pacers" | "Paul George" | - | "Suns" | "Grant Hill" | - | "Magic" | "Grant Hill" | - | "Clippers" | "Grant Hill" | - | "Pistons" | "Grant Hill" | - | "Celtics" | "Shaquille O'Neal" | - | "Cavaliers" | "Shaquille O'Neal" | - | "Lakers" | "Shaquille O'Neal" | - | "Magic" | "Shaquille O'Neal" | - | "Suns" | "Shaquille O'Neal" | - | "Heat" | "Shaquille O'Neal" | - | "Warriors" | "JaVale McGee" | - | "Mavericks" | "JaVale McGee" | - | "Wizards" | "JaVale McGee" | - | "Lakers" | "JaVale McGee" | - | "Nuggets" | "JaVale McGee" | - | "Rockets" | "Dwight Howard" | - | "Wizards" | "Dwight Howard" | - | "Magic" | "Dwight Howard" | - | "Hornets" | "Dwight Howard" | - | "Lakers" | "Dwight Howard" | - | "Hawks" | "Dwight Howard" | - | "Vince Carter" | "Nets" | - | "Jason Kidd" | "Nets" | - | "Grant Hill" | "Pistons" | - | "Blake Griffin" | "Pistons" | - | "Aron Baynes" | "Pistons" | - | "Ray Allen" | "Bucks" | - | "Paul Gasol" | "Bucks" | - | "Giannis Antetokounmpo" | "Bucks" | - | "Jason Kidd" | "Mavericks" | - | "Steve Nash" | "Mavericks" | - | "Jason Kidd" | "Mavericks" | - | "Dirk Nowitzki" | "Mavericks" | - | "JaVale McGee" | "Mavericks" | - | "Rajon Rondo" | "Mavericks" | - | "Kristaps Porzingis" | "Mavericks" | - | "Vince Carter" | "Mavericks" | - | "DeAndre Jordan" | "Mavericks" | - | "Luka Doncic" | "Mavericks" | - | "Grant Hill" | "Clippers" | - | "Blake Griffin" | "Clippers" | - | "DeAndre Jordan" | "Clippers" | - | "Chris Paul" | "Clippers" | - | "Russell Westbrook" | "Thunders" | - | "Kevin Durant" | "Thunders" | - | "Carmelo Anthony" | "Thunders" | - | "Ray Allen" | "Thunders" | - | "James Harden" | "Thunders" | - | "Paul George" | "Thunders" | - | "Kobe Bryant" | "Lakers" | - | "Steve Nash" | "Lakers" | - | "Rajon Rondo" | "Lakers" | - | "LeBron James" | "Lakers" | - | "JaVale McGee" | "Lakers" | - | "Dwight Howard" | "Lakers" | - | "Shaquille O'Neal" | "Lakers" | - | "Paul Gasol" | "Lakers" | - | "Ricky Rubio" | "Jazz" | - | "Boris Diaw" | "Jazz" | - | "Carmelo Anthony" | "Nuggets" | - | "JaVale McGee" | "Nuggets" | - | "Dwight Howard" | "Wizards" | - | "JaVale McGee" | "Wizards" | - | "David West" | "Pacers" | - | "Cory Joseph" | "Pacers" | - | "Paul George" | "Pacers" | - | "Ricky Rubio" | "Timberwolves" | - | "Vince Carter" | "Hawks" | - | "Boris Diaw" | "Hawks" | - | "Marco Belinelli" | "Hawks" | - | "Tiago Splitter" | "Hawks" | - | "Dwight Howard" | "Hawks" | - | "Marco Belinelli" | "Warriors" | - | "Klay Thompson" | "Warriors" | - | "JaVale McGee" | "Warriors" | - | "David West" | "Warriors" | - | "Stephen Curry" | "Warriors" | - | "Kevin Durant" | "Warriors" | - | "Jonathon Simmons" | "Magic" | - | "Grant Hill" | "Magic" | - | "Dwight Howard" | "Magic" | - | "Tracy McGrady" | "Magic" | - | "Vince Carter" | "Magic" | - | "Shaquille O'Neal" | "Magic" | - | "Carmelo Anthony" | "Rockets" | - | "Tracy McGrady" | "Rockets" | - | "Dwight Howard" | "Rockets" | - | "Yao Ming" | "Rockets" | - | "James Harden" | "Rockets" | - | "Chris Paul" | "Rockets" | - | "Rajon Rondo" | "Pelicans" | - | "Marc Gasol" | "Raptors" | - | "Vince Carter" | "Raptors" | - | "Danny Green" | "Raptors" | - | "Marco Belinelli" | "Raptors" | - | "Cory Joseph" | "Raptors" | - | "Rudy Gay" | "Raptors" | - | "Tracy McGrady" | "Raptors" | - | "Boris Diaw" | "Spurs" | - | "Kyle Anderson" | "Spurs" | - | "Cory Joseph" | "Spurs" | - | "Tiago Splitter" | "Spurs" | - | "LaMarcus Aldridge" | "Spurs" | - | "Paul Gasol" | "Spurs" | - | "Marco Belinelli" | "Spurs" | - | "Tracy McGrady" | "Spurs" | - | "David West" | "Spurs" | - | "Manu Ginobili" | "Spurs" | - | "Tony Parker" | "Spurs" | - | "Rudy Gay" | "Spurs" | - | "Jonathon Simmons" | "Spurs" | - | "Aron Baynes" | "Spurs" | - | "Danny Green" | "Spurs" | - | "Tim Duncan" | "Spurs" | - | "Marco Belinelli" | "Spurs" | - | "Dejounte Murray" | "Spurs" | - | "LeBron James" | "Heat" | - | "Dwyane Wade" | "Heat" | - | "Ray Allen" | "Heat" | - | "Amar'e Stoudemire" | "Heat" | - | "Dwyane Wade" | "Heat" | - | "Shaquille O'Neal" | "Heat" | - | "Marc Gasol" | "Grizzlies" | - | "Kyle Anderson" | "Grizzlies" | - | "Vince Carter" | "Grizzlies" | - | "Paul Gasol" | "Grizzlies" | - | "Rudy Gay" | "Grizzlies" | - | "Kristaps Porzingis" | "Knicks" | - | "Jason Kidd" | "Knicks" | - | "Carmelo Anthony" | "Knicks" | - | "DeAndre Jordan" | "Knicks" | - | "Amar'e Stoudemire" | "Knicks" | - | "Steve Nash" | "Suns" | - | "Steve Nash" | "Suns" | - | "Grant Hill" | "Suns" | - | "Vince Carter" | "Suns" | - | "Amar'e Stoudemire" | "Suns" | - | "Shaquille O'Neal" | "Suns" | - | "Jason Kidd" | "Suns" | - | "Boris Diaw" | "Suns" | - | "David West" | "Hornets" | - | "Boris Diaw" | "Hornets" | - | "Marco Belinelli" | "Hornets" | - | "Chris Paul" | "Hornets" | - | "Dwight Howard" | "Hornets" | - | "Tony Parker" | "Hornets" | - | "Marco Belinelli" | "Hornets" | - | "LeBron James" | "Cavaliers" | - | "LeBron James" | "Cavaliers" | - | "Dwyane Wade" | "Cavaliers" | - | "Kyrie Irving" | "Cavaliers" | - | "Danny Green" | "Cavaliers" | - | "Shaquille O'Neal" | "Cavaliers" | - | "Marco Belinelli" | "Kings" | - | "Rajon Rondo" | "Kings" | - | "Rudy Gay" | "Kings" | - | "Vince Carter" | "Kings" | - | "Aron Baynes" | "Celtics" | - | "Shaquille O'Neal" | "Celtics" | - | "Kyrie Irving" | "Celtics" | - | "Rajon Rondo" | "Celtics" | - | "Ray Allen" | "Celtics" | - | "Ben Simmons" | "76ers" | - | "Joel Embiid" | "76ers" | - | "Tiago Splitter" | "76ers" | - | "Marco Belinelli" | "76ers" | - | "Jonathon Simmons" | "76ers" | - | "LaMarcus Aldridge" | "Trail Blazers" | - | "Damian Lillard" | "Trail Blazers" | - | "Dwyane Wade" | "Bulls" | - | "Rajon Rondo" | "Bulls" | - | "Paul Gasol" | "Bulls" | - | "Marco Belinelli" | "Bulls" | + | player.player.name | team.team.name | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | NULL | NULL | + | "Vince Carter" | "Nets" | + | "Jason Kidd" | "Nets" | + | "Grant Hill" | "Pistons" | + | "Blake Griffin" | "Pistons" | + | "Aron Baynes" | "Pistons" | + | "Ray Allen" | "Bucks" | + | "Paul Gasol" | "Bucks" | + | "Giannis Antetokounmpo" | "Bucks" | + | "Jason Kidd" | "Mavericks" | + | "Steve Nash" | "Mavericks" | + | "Jason Kidd" | "Mavericks" | + | "Dirk Nowitzki" | "Mavericks" | + | "JaVale McGee" | "Mavericks" | + | "Rajon Rondo" | "Mavericks" | + | "Kristaps Porzingis" | "Mavericks" | + | "Vince Carter" | "Mavericks" | + | "DeAndre Jordan" | "Mavericks" | + | "Luka Doncic" | "Mavericks" | + | "Grant Hill" | "Clippers" | + | "Blake Griffin" | "Clippers" | + | "DeAndre Jordan" | "Clippers" | + | "Chris Paul" | "Clippers" | + | "Russell Westbrook" | "Thunders" | + | "Kevin Durant" | "Thunders" | + | "Carmelo Anthony" | "Thunders" | + | "Ray Allen" | "Thunders" | + | "James Harden" | "Thunders" | + | "Paul George" | "Thunders" | + | "Kobe Bryant" | "Lakers" | + | "Steve Nash" | "Lakers" | + | "Rajon Rondo" | "Lakers" | + | "LeBron James" | "Lakers" | + | "JaVale McGee" | "Lakers" | + | "Dwight Howard" | "Lakers" | + | "Shaquille O'Neal" | "Lakers" | + | "Paul Gasol" | "Lakers" | + | "Ricky Rubio" | "Jazz" | + | "Boris Diaw" | "Jazz" | + | "Carmelo Anthony" | "Nuggets" | + | "JaVale McGee" | "Nuggets" | + | "Dwight Howard" | "Wizards" | + | "JaVale McGee" | "Wizards" | + | "David West" | "Pacers" | + | "Cory Joseph" | "Pacers" | + | "Paul George" | "Pacers" | + | "Ricky Rubio" | "Timberwolves" | + | "Vince Carter" | "Hawks" | + | "Boris Diaw" | "Hawks" | + | "Marco Belinelli" | "Hawks" | + | "Tiago Splitter" | "Hawks" | + | "Dwight Howard" | "Hawks" | + | "Marco Belinelli" | "Warriors" | + | "Klay Thompson" | "Warriors" | + | "JaVale McGee" | "Warriors" | + | "David West" | "Warriors" | + | "Stephen Curry" | "Warriors" | + | "Kevin Durant" | "Warriors" | + | "Jonathon Simmons" | "Magic" | + | "Grant Hill" | "Magic" | + | "Dwight Howard" | "Magic" | + | "Tracy McGrady" | "Magic" | + | "Vince Carter" | "Magic" | + | "Shaquille O'Neal" | "Magic" | + | "Carmelo Anthony" | "Rockets" | + | "Tracy McGrady" | "Rockets" | + | "Dwight Howard" | "Rockets" | + | "Yao Ming" | "Rockets" | + | "James Harden" | "Rockets" | + | "Chris Paul" | "Rockets" | + | "Rajon Rondo" | "Pelicans" | + | "Marc Gasol" | "Raptors" | + | "Vince Carter" | "Raptors" | + | "Danny Green" | "Raptors" | + | "Marco Belinelli" | "Raptors" | + | "Cory Joseph" | "Raptors" | + | "Rudy Gay" | "Raptors" | + | "Tracy McGrady" | "Raptors" | + | "Boris Diaw" | "Spurs" | + | "Kyle Anderson" | "Spurs" | + | "Cory Joseph" | "Spurs" | + | "Tiago Splitter" | "Spurs" | + | "LaMarcus Aldridge" | "Spurs" | + | "Paul Gasol" | "Spurs" | + | "Marco Belinelli" | "Spurs" | + | "Tracy McGrady" | "Spurs" | + | "David West" | "Spurs" | + | "Manu Ginobili" | "Spurs" | + | "Tony Parker" | "Spurs" | + | "Rudy Gay" | "Spurs" | + | "Jonathon Simmons" | "Spurs" | + | "Aron Baynes" | "Spurs" | + | "Danny Green" | "Spurs" | + | "Tim Duncan" | "Spurs" | + | "Marco Belinelli" | "Spurs" | + | "Dejounte Murray" | "Spurs" | + | "LeBron James" | "Heat" | + | "Dwyane Wade" | "Heat" | + | "Ray Allen" | "Heat" | + | "Amar'e Stoudemire" | "Heat" | + | "Dwyane Wade" | "Heat" | + | "Shaquille O'Neal" | "Heat" | + | "Marc Gasol" | "Grizzlies" | + | "Kyle Anderson" | "Grizzlies" | + | "Vince Carter" | "Grizzlies" | + | "Paul Gasol" | "Grizzlies" | + | "Rudy Gay" | "Grizzlies" | + | "Kristaps Porzingis" | "Knicks" | + | "Jason Kidd" | "Knicks" | + | "Carmelo Anthony" | "Knicks" | + | "DeAndre Jordan" | "Knicks" | + | "Amar'e Stoudemire" | "Knicks" | + | "Steve Nash" | "Suns" | + | "Steve Nash" | "Suns" | + | "Grant Hill" | "Suns" | + | "Vince Carter" | "Suns" | + | "Amar'e Stoudemire" | "Suns" | + | "Shaquille O'Neal" | "Suns" | + | "Jason Kidd" | "Suns" | + | "Boris Diaw" | "Suns" | + | "David West" | "Hornets" | + | "Boris Diaw" | "Hornets" | + | "Marco Belinelli" | "Hornets" | + | "Chris Paul" | "Hornets" | + | "Dwight Howard" | "Hornets" | + | "Tony Parker" | "Hornets" | + | "Marco Belinelli" | "Hornets" | + | "LeBron James" | "Cavaliers" | + | "LeBron James" | "Cavaliers" | + | "Dwyane Wade" | "Cavaliers" | + | "Kyrie Irving" | "Cavaliers" | + | "Danny Green" | "Cavaliers" | + | "Shaquille O'Neal" | "Cavaliers" | + | "Marco Belinelli" | "Kings" | + | "Rajon Rondo" | "Kings" | + | "Rudy Gay" | "Kings" | + | "Vince Carter" | "Kings" | + | "Aron Baynes" | "Celtics" | + | "Shaquille O'Neal" | "Celtics" | + | "Kyrie Irving" | "Celtics" | + | "Rajon Rondo" | "Celtics" | + | "Ray Allen" | "Celtics" | + | "Ben Simmons" | "76ers" | + | "Joel Embiid" | "76ers" | + | "Tiago Splitter" | "76ers" | + | "Marco Belinelli" | "76ers" | + | "Jonathon Simmons" | "76ers" | + | "LaMarcus Aldridge" | "Trail Blazers" | + | "Damian Lillard" | "Trail Blazers" | + | "Dwyane Wade" | "Bulls" | + | "Rajon Rondo" | "Bulls" | + | "Paul Gasol" | "Bulls" | + | "Marco Belinelli" | "Bulls" | When executing query: """ MATCH (p1)-[:like]->(player)-[:serve]->(team) - RETURN p1.name, player.name, team.name + RETURN p1.player.name, player.player.name, team.team.name """ Then the result should be, in any order: - | p1.name | player.name | team.name | + | p1.player.name | player.player.name | team.team.name | | "Amar'e Stoudemire" | "Steve Nash" | "Suns" | | "Amar'e Stoudemire" | "Steve Nash" | "Lakers" | | "Amar'e Stoudemire" | "Steve Nash" | "Mavericks" | @@ -877,10 +877,10 @@ Feature: Match seek by edge Scenario Outline: Seek by edge with range When executing query: """ - match (p1)-[:like*2]->(p2) return p1.name, p2.name + match (p1)-[:like*2]->(p2) return p1.player.name, p2.player.name """ Then the result should be, in any order: - | p1.name | p2.name | + | p1.player.name | p2.player.name | | "Amar'e Stoudemire" | "Dirk Nowitzki" | | "Amar'e Stoudemire" | "Jason Kidd" | | "Amar'e Stoudemire" | "Amar'e Stoudemire" | @@ -1041,10 +1041,10 @@ Feature: Match seek by edge | "Shaquille O'Neal" | "Manu Ginobili" | When executing query: """ - match (p1)-[:like*1..2]->(p2) return p1.name, p2.name + match (p1)-[:like*1..2]->(p2) return p1.player.name, p2.player.name """ Then the result should be, in any order: - | p1.name | p2.name | + | p1.player.name | p2.player.name | | "Amar'e Stoudemire" | "Steve Nash" | | "Amar'e Stoudemire" | "Dirk Nowitzki" | | "Amar'e Stoudemire" | "Jason Kidd" | @@ -1286,15 +1286,15 @@ Feature: Match seek by edge | "Shaquille O'Neal" | "Manu Ginobili" | When executing query: """ - match (p1)-[:serve*2]->(p2) return p1.name, p2.name + match (p1)-[:serve*2]->(p2) return p1.player.name, p2.team.name """ Then the result should be, in any order: - | p1.name | p2.name | + | p1.player.name | p2.team.name | Scenario Outline: Seek by edge with properties When executing query: """ - match (player)-[:serve {start_year : 2001}]->(team) return player.name AS player, team.name AS team + match (player)-[:serve {start_year : 2001}]->(team) return player.player.name AS player, team.team.name AS team """ Then the result should be, in any order: | player | team | @@ -1302,7 +1302,7 @@ Feature: Match seek by edge | "Jason Kidd" | "Nets" | When executing query: """ - match (team)<-[:serve {start_year : 2001}]-(player) return player.name AS player, team.name AS team + match (team)<-[:serve {start_year : 2001}]-(player) return player.player.name AS player, team.team.name AS team """ Then the result should be, in any order: | player | team | @@ -1310,17 +1310,17 @@ Feature: Match seek by edge | "Jason Kidd" | "Nets" | When executing query: """ - match (player)-[:serve {start_year : 2001}]-(team) return player.name AS player, team.name AS team + match (player)-[:serve {start_year : 2001}]-(team) return player.player.name AS player, team.team.name AS team """ Then the result should be, in any order: - | player | team | - | "Paul Gasol" | "Grizzlies" | - | "Jason Kidd" | "Nets" | - | "Grizzlies" | "Paul Gasol" | - | "Nets" | "Jason Kidd" | + | player | team | + | "Paul Gasol" | "Grizzlies" | + | "Jason Kidd" | "Nets" | + | NULL | NULL | + | NULL | NULL | When executing query: """ - match (player)-[s:serve]->(team) where s.start_year == 2001 return player.name AS player, team.name AS team + match (player)-[s:serve]->(team) where s.start_year == 2001 return player.player.name AS player, team.team.name AS team """ Then the result should be, in any order: | player | team | @@ -1328,7 +1328,7 @@ Feature: Match seek by edge | "Jason Kidd" | "Nets" | When executing query: """ - match (team)<-[s:serve]-(player) where s.start_year == 2001 return player.name AS player, team.name AS team + match (team)<-[s:serve]-(player) where s.start_year == 2001 return player.player.name AS player, team.team.name AS team """ Then the result should be, in any order: | player | team | @@ -1336,22 +1336,22 @@ Feature: Match seek by edge | "Jason Kidd" | "Nets" | When executing query: """ - match (player)-[s:serve]-(team) where s.start_year == 2001 return player.name AS player, team.name AS team + match (p)-[s:serve]-(t) where s.start_year == 2001 return p.player.name AS player, t.team.name AS team """ Then the result should be, in any order: - | player | team | - | "Paul Gasol" | "Grizzlies" | - | "Jason Kidd" | "Nets" | - | "Grizzlies" | "Paul Gasol" | - | "Nets" | "Jason Kidd" | + | player | team | + | "Paul Gasol" | "Grizzlies" | + | "Jason Kidd" | "Nets" | + | NULL | NULL | + | NULL | NULL | Scenario Outline: Seek by edge with range with properties When executing query: """ - match (p1)-[:like*2 {likeness: 90}]->(p2) return p1.name, p2.name + match (p1)-[:like*2 {likeness: 90}]->(p2) return p1.player.name, p2.player.name """ Then the result should be, in any order: - | p1.name | p2.name | + | p1.player.name | p2.player.name | | "Amar'e Stoudemire" | "Amar'e Stoudemire" | | "Amar'e Stoudemire" | "Stephen Curry" | | "Tracy McGrady" | "Tracy McGrady" | @@ -1391,10 +1391,10 @@ Feature: Match seek by edge | "Grant Hill" | "Rudy Gay" | When executing query: """ - match (p1)-[l:like*1..2 {likeness: 90}]->(p2) return p1.name, p2.name + match (p1)-[l:like*1..2 {likeness: 90}]->(p2) return p1.player.name, p2.player.name """ Then the result should be, in any order: - | p1.name | p2.name | + | p1.player.name | p2.player.name | | "Amar'e Stoudemire" | "Steve Nash" | | "Amar'e Stoudemire" | "Amar'e Stoudemire" | | "Amar'e Stoudemire" | "Stephen Curry" | @@ -1467,7 +1467,7 @@ Feature: Match seek by edge When executing query: """ MATCH (p1)-[:teammate]->(p2) - RETURN p1.name, id(p2) + RETURN p1.player.name, id(p2) """ Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. @@ -1488,18 +1488,18 @@ Feature: Match seek by edge When executing query: """ MATCH (p1)-[]->(p2) - RETURN p1.name, id(p2) + RETURN p1.tag_1.name, id(p2) """ Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. When executing query: """ MATCH (p1)-[b]->(p2) - RETURN p1.name, id(p2) + RETURN p1.tag_1.name, id(p2) """ Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. When executing query: """ MATCH (p1)-[:edge_1]->(p2) - RETURN p1.name, id(p2) + RETURN p1.tag_1.name, id(p2) """ Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. diff --git a/tests/tck/features/match/SeekById.feature b/tests/tck/features/match/SeekById.feature index ebc583aa433..2b55ac72bd6 100644 --- a/tests/tck/features/match/SeekById.feature +++ b/tests/tck/features/match/SeekById.feature @@ -8,7 +8,7 @@ Feature: Match seek by id """ MATCH (v) WHERE id(v) == 'Paul Gasol' - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age """ Then the result should be, in any order: | Name | Age | @@ -17,7 +17,7 @@ Feature: Match seek by id """ MATCH (v) WHERE id(v) IN ['James Harden', 'Jonathon Simmons', 'Klay Thompson', 'Dejounte Murray'] - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -31,7 +31,7 @@ Feature: Match seek by id """ MATCH (v) WHERE NOT NOT id(v) == 'Paul Gasol' - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age """ Then the result should be, in any order: | Name | Age | @@ -40,7 +40,7 @@ Feature: Match seek by id """ MATCH (v) WHERE NOT NOT id(v) IN ['James Harden', 'Jonathon Simmons', 'Klay Thompson', 'Dejounte Murray'] - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -54,7 +54,7 @@ Feature: Match seek by id """ MATCH (v) WHERE (NOT NOT id(v) == 'Paul Gasol') AND id(v) IN ['James Harden', 'Jonathon Simmons', 'Klay Thompson', 'Dejounte Murray'] - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -62,7 +62,7 @@ Feature: Match seek by id """ MATCH (v) WHERE (NOT NOT id(v) == 'Paul Gasol') AND id(v) IN ['James Harden', 'Jonathon Simmons', 'Klay Thompson', 'Dejounte Murray', 'Paul Gasol'] - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -73,7 +73,7 @@ Feature: Match seek by id """ MATCH (v) WHERE (NOT NOT id(v) == 'Paul Gasol') OR id(v) IN ['James Harden', 'Jonathon Simmons', 'Klay Thompson', 'Dejounte Murray'] - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -86,7 +86,7 @@ Feature: Match seek by id """ MATCH (v) WHERE (NOT NOT id(v) == 'Paul Gasol') OR id(v) IN ['James Harden', 'Jonathon Simmons', 'Klay Thompson', 'Dejounte Murray', 'Paul Gasol'] - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -101,7 +101,7 @@ Feature: Match seek by id """ MATCH (v) WHERE (NOT NOT id(v) == 'Paul Gasol') AND id(v) == 'Paul Gasol' - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -110,7 +110,7 @@ Feature: Match seek by id """ MATCH (v) WHERE (NOT NOT id(v) == 'Paul Gasol') AND id(v) != 'Paul Gasol' - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -119,7 +119,7 @@ Feature: Match seek by id MATCH (v) WHERE id(v) IN ['James Harden', 'Jonathon Simmons', 'Klay Thompson', 'Dejounte Murray', 'Paul Gasol'] OR false - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -132,8 +132,8 @@ Feature: Match seek by id """ MATCH (v) WHERE id(v) IN ['James Harden', 'Jonathon Simmons', 'Klay Thompson', 'Dejounte Murray', 'Paul Gasol'] - AND (id(v) == 'James Harden' OR v.age == 23) - RETURN v.name AS Name + AND (id(v) == 'James Harden' OR v.player.age == 23) + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -141,8 +141,8 @@ Feature: Match seek by id When executing query: """ MATCH (v:player) - WHERE id(v) IN ['James Harden', v.age] - RETURN v.name AS Name + WHERE id(v) IN ['James Harden', v.player.age] + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -155,9 +155,9 @@ Feature: Match seek by id WHERE ((NOT NOT id(v) == 'Paul Gasol') OR id(v) IN ['James Harden', 'Jonathon Simmons', 'Klay Thompson', 'Dejounte Murray']) AND id(v) != 'Paul Gasol' - AND v.name != 'Jonathon Simmons' - AND v.age == 29 - RETURN v.name AS Name + AND v.player.name != 'Jonathon Simmons' + AND v.player.age == 29 + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -167,8 +167,8 @@ Feature: Match seek by id When executing query: """ MATCH (v) - WHERE (id(v) == "Tim Duncan" AND v.age>10) OR (id(v) == "Tony Parker" AND v.age>10) - RETURN v.name AS Name + WHERE (id(v) == "Tim Duncan" AND v.player.age>10) OR (id(v) == "Tony Parker" AND v.player.age>10) + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -180,7 +180,7 @@ Feature: Match seek by id """ MATCH (v)-[:serve]->(t) WHERE (NOT NOT id(v) == 'Paul Gasol') AND id(v) == 'Paul Gasol' - RETURN v.name AS Name, t.name AS Team + RETURN v.player.name AS Name, t.team.name AS Team """ Then the result should be, in any order: | Name | Team | @@ -195,7 +195,7 @@ Feature: Match seek by id """ MATCH (v)-[:serve]->(t) WHERE (NOT NOT id(v) == 'Paul Gasol') AND id(v) == 'Paul Gasol' AND id(t) IN ['Grizzlies', 'Lakers'] - RETURN v.name AS Name, t.name AS Team + RETURN v.player.name AS Name, t.team.name AS Team """ Then the result should be, in any order: | Name | Team | @@ -205,7 +205,7 @@ Feature: Match seek by id """ MATCH (v)-[:serve]->(t) WHERE ((NOT NOT id(v) == 'Paul Gasol') AND id(v) == 'Paul Gasol') OR id(t) IN ['Grizzlies', 'Lakers'] - RETURN v.name AS Name, t.name AS Team + RETURN v.player.name AS Name, t.team.name AS Team """ Then the result should be, in any order: | Name | Team | @@ -220,60 +220,81 @@ Feature: Match seek by id """ MATCH (v) WHERE NOT id(v) == 'Paul Gasol' - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age """ Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. When executing query: """ MATCH (v) WHERE NOT id(v) IN ['James Harden', 'Jonathon Simmons', 'Klay Thompson', 'Dejounte Murray'] - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. When executing query: """ MATCH (v) - WHERE id(v) IN ['James Harden', 'Jonathon Simmons', 'Klay Thompson', 'Dejounte Murray'] - OR v.age == 23 - RETURN v.name AS Name + WHERE id(x) == 'James Harden' + RETURN v.player.name AS Name """ - Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. + Then a SemanticError should be raised at runtime: Alias used but not defined: `x' When executing query: """ MATCH (v) - WHERE id(v) == 'James Harden' - OR v.age == 23 - RETURN v.name AS Name + WHERE (id(v) + '') == 'James Harden' + RETURN v.player.name AS Name + """ + Then a SemanticError should be raised at runtime: + When executing query: + """ + MATCH (v) + WHERE id(v) IN ['James Harden', v.player.name] + RETURN v.player.name AS Name """ Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. + + @skip + Scenario: test OR logic (reason = "or logic optimization error") When executing query: """ MATCH (v) - WHERE id(x) == 'James Harden' - RETURN v.name AS Name + WHERE id(v) IN ['James Harden', 'Jonathon Simmons', 'Klay Thompson', 'Dejounte Murray'] + OR v.player.age == 23 + RETURN v.player.name AS Name """ - Then a SemanticError should be raised at runtime: Alias used but not defined: `x' + Then the result should be, in any order: + | Name | + | 'James Harden' | + | 'Jonathon Simmons' | + | 'Klay Thompson' | + | 'Dejounte Murray' | + | 'Kristaps Porzingis' | When executing query: """ MATCH (v) - WHERE (id(v) + '') == 'James Harden' - RETURN v.name AS Name + WHERE id(v) == 'James Harden' + OR v.player.age == 23 + RETURN v.player.name AS Name """ - Then a SemanticError should be raised at runtime: + Then the result should be, in any order: + | Name | + | 'James Harden' | + | 'Kristaps Porzingis' | When executing query: """ MATCH (v) - WHERE id(v) IN ['James Harden', v.name] - RETURN v.name AS Name + WHERE id(v) == 'James Harden' + OR v.player.age != 23 + RETURN v.player.name AS Name """ - Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. + Then the result should be, in any order: + | Name | Scenario: Start from end When executing query: """ MATCH (v)-[:serve]->(t) WHERE id(t) == 'Pistons' - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | diff --git a/tests/tck/features/match/SeekById.intVid.feature b/tests/tck/features/match/SeekById.intVid.feature index e0ee24255b9..70fec05da7b 100644 --- a/tests/tck/features/match/SeekById.intVid.feature +++ b/tests/tck/features/match/SeekById.intVid.feature @@ -8,7 +8,7 @@ Feature: Match seek by id """ MATCH (v) WHERE id(v) == hash('Paul Gasol') - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age """ Then the result should be, in any order: | Name | Age | @@ -17,7 +17,7 @@ Feature: Match seek by id """ MATCH (v) WHERE id(v) IN [hash('James Harden'), hash('Jonathon Simmons'), hash('Klay Thompson'), hash('Dejounte Murray')] - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -31,7 +31,7 @@ Feature: Match seek by id """ MATCH (v) WHERE NOT NOT id(v) == hash('Paul Gasol') - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age """ Then the result should be, in any order: | Name | Age | @@ -40,7 +40,7 @@ Feature: Match seek by id """ MATCH (v) WHERE NOT NOT id(v) IN [hash('James Harden'), hash('Jonathon Simmons'), hash('Klay Thompson'), hash('Dejounte Murray')] - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -54,7 +54,7 @@ Feature: Match seek by id """ MATCH (v) WHERE (NOT NOT id(v) == hash('Paul Gasol')) AND id(v) IN [hash('James Harden'), hash('Jonathon Simmons'), hash('Klay Thompson'), hash('Dejounte Murray')] - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -62,7 +62,7 @@ Feature: Match seek by id """ MATCH (v) WHERE (NOT NOT id(v) == hash('Paul Gasol')) AND id(v) IN [hash('James Harden'), hash('Jonathon Simmons'), hash('Klay Thompson'), hash('Dejounte Murray'), hash('Paul Gasol')] - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -73,7 +73,7 @@ Feature: Match seek by id """ MATCH (v) WHERE (NOT NOT id(v) == hash('Paul Gasol')) OR id(v) IN [hash('James Harden'), hash('Jonathon Simmons'), hash('Klay Thompson'), hash('Dejounte Murray')] - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -86,7 +86,7 @@ Feature: Match seek by id """ MATCH (v) WHERE (NOT NOT id(v) == hash('Paul Gasol')) OR id(v) IN [hash('James Harden'), hash('Jonathon Simmons'), hash('Klay Thompson'), hash('Dejounte Murray'), hash('Paul Gasol')] - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -101,7 +101,7 @@ Feature: Match seek by id """ MATCH (v) WHERE (NOT NOT id(v) == hash('Paul Gasol')) AND id(v) == hash('Paul Gasol') - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -110,7 +110,7 @@ Feature: Match seek by id """ MATCH (v) WHERE (NOT NOT id(v) == hash('Paul Gasol')) AND id(v) != hash('Paul Gasol') - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -119,7 +119,7 @@ Feature: Match seek by id MATCH (v) WHERE id(v) IN [hash('James Harden'), hash('Jonathon Simmons'), hash('Klay Thompson'), hash('Dejounte Murray'), hash('Paul Gasol')] OR false - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -132,8 +132,8 @@ Feature: Match seek by id """ MATCH (v) WHERE id(v) IN [hash('James Harden'), hash('Jonathon Simmons'), hash('Klay Thompson'), hash('Dejounte Murray'), hash('Paul Gasol')] - AND (id(v) == hash('James Harden') OR v.age == 23) - RETURN v.name AS Name + AND (id(v) == hash('James Harden') OR v.player.age == 23) + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -141,8 +141,8 @@ Feature: Match seek by id When executing query: """ MATCH (v:player) - WHERE id(v) IN [hash('James Harden'), v.age] - RETURN v.name AS Name + WHERE id(v) IN [hash('James Harden'), v.player.age] + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -155,9 +155,9 @@ Feature: Match seek by id WHERE ((NOT NOT id(v) == hash('Paul Gasol')) OR id(v) IN [hash('James Harden'), hash('Jonathon Simmons'), hash('Klay Thompson'), hash('Dejounte Murray')]) AND id(v) != hash('Paul Gasol') - AND v.name != 'Jonathon Simmons' - AND v.age == 29 - RETURN v.name AS Name + AND v.player.name != 'Jonathon Simmons' + AND v.player.age == 29 + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -167,8 +167,8 @@ Feature: Match seek by id When executing query: """ MATCH (v) - WHERE (id(v) == hash("Tim Duncan") AND v.age>10) OR (id(v) == hash("Tony Parker") AND v.age>10) - RETURN v.name AS Name + WHERE (id(v) == hash("Tim Duncan") AND v.player.age>10) OR (id(v) == hash("Tony Parker") AND v.player.age>10) + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | @@ -180,7 +180,7 @@ Feature: Match seek by id """ MATCH (v)-[:serve]->(t) WHERE (NOT NOT id(v) == hash('Paul Gasol')) AND id(v) == hash('Paul Gasol') - RETURN v.name AS Name, t.name AS Team + RETURN v.player.name AS Name, t.team.name AS Team """ Then the result should be, in any order: | Name | Team | @@ -195,7 +195,7 @@ Feature: Match seek by id """ MATCH (v)-[:serve]->(t) WHERE (NOT NOT id(v) == hash('Paul Gasol')) AND id(v) == hash('Paul Gasol') AND id(t) IN [hash('Grizzlies'), hash('Lakers')] - RETURN v.name AS Name, t.name AS Team + RETURN v.player.name AS Name, t.team.name AS Team """ Then the result should be, in any order: | Name | Team | @@ -205,7 +205,7 @@ Feature: Match seek by id """ MATCH (v)-[:serve]->(t) WHERE ((NOT NOT id(v) == hash('Paul Gasol')) AND id(v) == hash('Paul Gasol')) OR id(t) IN [hash('Grizzlies'), hash('Lakers')] - RETURN v.name AS Name, t.name AS Team + RETURN v.player.name AS Name, t.team.name AS Team """ Then the result should be, in any order: | Name | Team | @@ -220,53 +220,74 @@ Feature: Match seek by id """ MATCH (v) WHERE NOT id(v) == hash('Paul Gasol') - RETURN v.name AS Name, v.age AS Age + RETURN v.player.name AS Name, v.player.age AS Age """ Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. When executing query: """ MATCH (v) WHERE NOT id(v) IN [hash('James Harden'), hash('Jonathon Simmons'), hash('Klay Thompson'), hash('Dejounte Murray')] - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. When executing query: """ MATCH (v) - WHERE id(v) IN [hash('James Harden'), hash('Jonathon Simmons'), hash('Klay Thompson'), hash('Dejounte Murray')] - OR v.age == 23 - RETURN v.name AS Name + WHERE id(x) == hash('James Harden') + RETURN v.player.name AS Name """ - Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. + Then a SemanticError should be raised at runtime: Alias used but not defined: `x' When executing query: """ MATCH (v) - WHERE id(v) == hash('James Harden') - OR v.age == 23 - RETURN v.name AS Name + WHERE id(v) IN [hash('James Harden'), v.player.name] + RETURN v.player.name AS Name """ Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. + + @skip + Scenario: test OR logic (reason = "or logic optimization error") When executing query: """ MATCH (v) - WHERE id(x) == hash('James Harden') - RETURN v.name AS Name + WHERE id(v) IN [hash('James Harden'), hash('Jonathon Simmons'), hash('Klay Thompson'), hash('Dejounte Murray')] + OR v.player.age == 23 + RETURN v.player.name AS Name """ - Then a SemanticError should be raised at runtime: Alias used but not defined: `x' + Then the result should be, in any order: + | Name | + | 'James Harden' | + | 'Jonathon Simmons' | + | 'Klay Thompson' | + | 'Dejounte Murray' | + | 'Kristaps Porzingis' | When executing query: """ MATCH (v) - WHERE id(v) IN [hash('James Harden'), v.name] - RETURN v.name AS Name + WHERE id(v) == hash('James Harden') + OR v.player.age == 23 + RETURN v.player.name AS Name """ - Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. + Then the result should be, in any order: + | Name | + | 'James Harden' | + | 'Kristaps Porzingis' | + When executing query: + """ + MATCH (v) + WHERE id(v) == hash('James Harden') + OR v.player.age != 23 + RETURN v.player.name AS Name + """ + Then the result should be, in any order: + | Name | Scenario: with arithmetic When executing query: """ MATCH (v) WHERE (id(v) + 1) == hash('James Harden') - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the execution should be successful @@ -275,7 +296,7 @@ Feature: Match seek by id """ MATCH (v)-[:serve]->(t) WHERE id(t) == hash('Pistons') - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | diff --git a/tests/tck/features/match/SeekByTag.feature b/tests/tck/features/match/SeekByTag.feature index dd579f9539d..41112033427 100644 --- a/tests/tck/features/match/SeekByTag.feature +++ b/tests/tck/features/match/SeekByTag.feature @@ -16,7 +16,7 @@ Feature: Match seek by tag When executing query: """ MATCH (v:bachelor) - RETURN id(v) AS vid, v.age AS age + RETURN id(v) AS vid, v.player.age AS age """ Then the result should be, in any order: | vid | age | @@ -65,7 +65,7 @@ Feature: Match seek by tag When executing query: """ MATCH (v:team) - RETURN id(v) AS vid, v.name AS name + RETURN id(v) AS vid, v.team.name AS name """ Then the result should be, in any order: | vid | name | @@ -105,7 +105,7 @@ Feature: Match seek by tag When executing query: """ MATCH (p:bachelor)-[:serve]->(t) - RETURN t.name AS team + RETURN t.team.name AS team """ Then the result should be, in any order: | team | diff --git a/tests/tck/features/match/SeekByTag.intVid.feature b/tests/tck/features/match/SeekByTag.intVid.feature index 6cb984dbf0d..093a7559fe2 100644 --- a/tests/tck/features/match/SeekByTag.intVid.feature +++ b/tests/tck/features/match/SeekByTag.intVid.feature @@ -16,7 +16,7 @@ Feature: Match seek by tag When executing query: """ MATCH (v:bachelor) - RETURN id(v) AS vid, v.age AS age + RETURN id(v) AS vid, v.player.age AS age """ Then the result should be, in any order, and the columns 0 should be hashed: | vid | age | @@ -65,7 +65,7 @@ Feature: Match seek by tag When executing query: """ MATCH (v:team) - RETURN id(v) AS vid, v.name AS name + RETURN id(v) AS vid, v.team.name AS name """ Then the result should be, in any order, and the columns 0 should be hashed: | vid | name | @@ -105,7 +105,7 @@ Feature: Match seek by tag When executing query: """ MATCH (p:bachelor)-[:serve]->(t) - RETURN t.name AS team + RETURN t.team.name AS team """ Then the result should be, in any order: | team | diff --git a/tests/tck/features/match/StartFromAnyNode.IntVid.feature b/tests/tck/features/match/StartFromAnyNode.IntVid.feature index 95b7d7abaad..c45297acfd9 100644 --- a/tests/tck/features/match/StartFromAnyNode.IntVid.feature +++ b/tests/tck/features/match/StartFromAnyNode.IntVid.feature @@ -29,7 +29,7 @@ Feature: Start From Any Node When executing query: """ MATCH (n)-[]-(m:player)-[]-(l) - WHERE m.name=="Kyle Anderson" + WHERE m.player.name=="Kyle Anderson" RETURN n,m,l """ Then the result should be, in any order, with relax comparison: @@ -189,7 +189,7 @@ Feature: Start From Any Node When executing query: """ MATCH p = (n)-[]-(m:player{name:"Kyle Anderson"})-[]-(l)-[]-(k) - WHERE k.name == "Marc Gasol" + WHERE k.player.name == "Marc Gasol" RETURN n, m, l, k """ Then the result should be, in any order, with relax comparison: @@ -200,7 +200,7 @@ Feature: Start From Any Node When executing query: """ MATCH p = (n)-[]-(m:player{name:"Kyle Anderson"})-[]-(l)-[]-(k) - WHERE k.name == "Marc Gasol" + WHERE k.player.name == "Marc Gasol" RETURN p """ Then the result should be, in any order, with relax comparison: @@ -211,7 +211,7 @@ Feature: Start From Any Node When executing query: """ MATCH p = ()-[e1]-(m:player{name:"Kyle Anderson"})-[e2]-()-[e3]-(k) - WHERE k.name == "Marc Gasol" + WHERE k.player.name == "Marc Gasol" RETURN e1, e2, e3 """ Then the result should be, in any order, with relax comparison: @@ -230,7 +230,7 @@ Feature: Start From Any Node When executing query: """ MATCH p = (k)-[]-(n)-[]-(m:player{name:"Kobe Bryant"})-[]-(l) - WHERE l.name == "Lakers" + WHERE l.team.name == "Lakers" RETURN k, n, m, l """ Then the result should be, in any order, with relax comparison: @@ -254,7 +254,7 @@ Feature: Start From Any Node When executing query: """ MATCH p = (k)-[]-(n)-[]-(m:player{name:"Kobe Bryant"})-[]-(l) - WHERE l.name == "Lakers" + WHERE l.team.name == "Lakers" RETURN p """ Then the result should be, in any order, with relax comparison: @@ -278,7 +278,7 @@ Feature: Start From Any Node When executing query: """ MATCH ()-[e1]-()-[e2]-(:player{name:"Kobe Bryant"})-[e3]-(l) - WHERE l.name == "Lakers" + WHERE l.team.name == "Lakers" RETURN e1, e2, e3 """ Then the result should be, in any order, with relax comparison: @@ -312,7 +312,7 @@ Feature: Start From Any Node When executing query: """ MATCH p = ()-[]-(n)-[]-(m:player{name:"Kobe Bryant"})-[]-(l)-[]-(k) - WHERE k.name == "Paul Gasol" + WHERE k.player.name == "Paul Gasol" RETURN p """ Then the result should be, in any order, with relax comparison: @@ -335,7 +335,7 @@ Feature: Start From Any Node When executing query: """ MATCH (i)-[]-(n)-[]-(m:player{name:"Kobe Bryant"})-[]-(l)-[]-(k) - WHERE k.name == "Paul Gasol" + WHERE k.player.name == "Paul Gasol" RETURN i, n, m, l, k """ Then the result should be, in any order, with relax comparison: @@ -358,7 +358,7 @@ Feature: Start From Any Node When executing query: """ MATCH ()-[e1]-()-[e2]-(:player{name:"Kobe Bryant"})-[e3]-()-[e4]-(k) - WHERE k.name == "Paul Gasol" + WHERE k.player.name == "Paul Gasol" RETURN e1, e2, e3, e4 """ Then the result should be, in any order, with relax comparison: diff --git a/tests/tck/features/match/StartFromAnyNode.feature b/tests/tck/features/match/StartFromAnyNode.feature index b19ced3122d..51611f4201b 100644 --- a/tests/tck/features/match/StartFromAnyNode.feature +++ b/tests/tck/features/match/StartFromAnyNode.feature @@ -29,7 +29,7 @@ Feature: Start From Any Node When executing query: """ MATCH (n)-[]-(m:player)-[]-(l) - WHERE m.name=="Kyle Anderson" + WHERE m.player.name=="Kyle Anderson" RETURN n,m,l """ Then the result should be, in any order, with relax comparison: @@ -189,7 +189,7 @@ Feature: Start From Any Node When executing query: """ MATCH p = (n)-[]-(m:player{name:"Kyle Anderson"})-[]-(l)-[]-(k) - WHERE k.name == "Marc Gasol" + WHERE k.player.name == "Marc Gasol" RETURN n, m, l, k """ Then the result should be, in any order, with relax comparison: @@ -200,7 +200,7 @@ Feature: Start From Any Node When executing query: """ MATCH p = (n)-[]-(m:player{name:"Kyle Anderson"})-[]-(l)-[]-(k) - WHERE k.name == "Marc Gasol" + WHERE k.player.name == "Marc Gasol" RETURN p """ Then the result should be, in any order, with relax comparison: @@ -211,7 +211,7 @@ Feature: Start From Any Node When executing query: """ MATCH p = ()-[e1]-(m:player{name:"Kyle Anderson"})-[e2]-()-[e3]-(k) - WHERE k.name == "Marc Gasol" + WHERE k.player.name == "Marc Gasol" RETURN e1, e2, e3 """ Then the result should be, in any order, with relax comparison: @@ -230,7 +230,7 @@ Feature: Start From Any Node When executing query: """ MATCH p = (k)-[]-(n)-[]-(m:player{name:"Kobe Bryant"})-[]-(l) - WHERE l.name == "Lakers" + WHERE l.team.name == "Lakers" RETURN k, n, m, l """ Then the result should be, in any order, with relax comparison: @@ -254,7 +254,7 @@ Feature: Start From Any Node When executing query: """ MATCH p = (k)-[]-(n)-[]-(m:player{name:"Kobe Bryant"})-[]-(l) - WHERE l.name == "Lakers" + WHERE l.team.name == "Lakers" RETURN p """ Then the result should be, in any order, with relax comparison: @@ -278,7 +278,7 @@ Feature: Start From Any Node When executing query: """ MATCH ()-[e1]-()-[e2]-(:player{name:"Kobe Bryant"})-[e3]-(l) - WHERE l.name == "Lakers" + WHERE l.team.name == "Lakers" RETURN e1, e2, e3 """ Then the result should be, in any order, with relax comparison: @@ -312,7 +312,7 @@ Feature: Start From Any Node When executing query: """ MATCH p = ()-[]-(n)-[]-(m:player{name:"Kobe Bryant"})-[]-(l)-[]-(k) - WHERE k.name == "Paul Gasol" + WHERE k.player.name == "Paul Gasol" RETURN p """ Then the result should be, in any order, with relax comparison: @@ -335,7 +335,7 @@ Feature: Start From Any Node When executing query: """ MATCH (i)-[]-(n)-[]-(m:player{name:"Kobe Bryant"})-[]-(l)-[]-(k) - WHERE k.name == "Paul Gasol" + WHERE k.player.name == "Paul Gasol" RETURN i, n, m, l, k """ Then the result should be, in any order, with relax comparison: @@ -358,7 +358,7 @@ Feature: Start From Any Node When executing query: """ MATCH ()-[e1]-()-[e2]-(:player{name:"Kobe Bryant"})-[e3]-()-[e4]-(k) - WHERE k.name == "Paul Gasol" + WHERE k.player.name == "Paul Gasol" RETURN e1, e2, e3, e4 """ Then the result should be, in any order, with relax comparison: diff --git a/tests/tck/features/match/VariableLengthPattern.feature b/tests/tck/features/match/VariableLengthPattern.feature index aec0c9b9b3d..8d3b26edf05 100644 --- a/tests/tck/features/match/VariableLengthPattern.feature +++ b/tests/tck/features/match/VariableLengthPattern.feature @@ -350,28 +350,28 @@ Feature: Variable length Pattern match (m to n) Scenario: Over expand end When executing query: """ - MATCH (v:player {name: "Yao Ming"})-[:serve*0..1]->() RETURN v.name + MATCH (v:player {name: "Yao Ming"})-[:serve*0..1]->() RETURN v.player.name """ Then the result should be, in any order: - | v.name | - | "Yao Ming" | - | "Yao Ming" | + | v.player.name | + | "Yao Ming" | + | "Yao Ming" | When executing query: """ - MATCH (v:player {name: "Yao Ming"})-[:serve*1..3]->() RETURN v.name + MATCH (v:player {name: "Yao Ming"})-[:serve*1..3]->() RETURN v.player.name """ Then the result should be, in any order: - | v.name | - | "Yao Ming" | + | v.player.name | + | "Yao Ming" | When executing query: """ - MATCH (v:player {name: "Yao Ming"})-[:serve*2..3]->() RETURN v.name + MATCH (v:player {name: "Yao Ming"})-[:serve*2..3]->() RETURN v.player.name """ Then the result should be, in any order: - | v.name | + | v.player.name | When executing query: """ - MATCH (v:player {name: "Yao Ming"})-[:serve*1000000000..1000000002]->() RETURN v.name + MATCH (v:player {name: "Yao Ming"})-[:serve*1000000000..1000000002]->() RETURN v.player.name """ Then the result should be, in any order: - | v.name | + | v.player.name | diff --git a/tests/tck/features/match/VariableLengthPattern.intVid.feature b/tests/tck/features/match/VariableLengthPattern.intVid.feature index 78c93039a93..70721c32c77 100644 --- a/tests/tck/features/match/VariableLengthPattern.intVid.feature +++ b/tests/tck/features/match/VariableLengthPattern.intVid.feature @@ -328,28 +328,28 @@ Feature: Integer Vid Variable length Pattern match (m to n) Scenario: Over expand end When executing query: """ - MATCH (v:player {name: "Yao Ming"})-[:serve*0..1]->() RETURN v.name + MATCH (v:player {name: "Yao Ming"})-[:serve*0..1]->() RETURN v.player.name """ Then the result should be, in any order: - | v.name | - | "Yao Ming" | - | "Yao Ming" | + | v.player.name | + | "Yao Ming" | + | "Yao Ming" | When executing query: """ - MATCH (v:player {name: "Yao Ming"})-[:serve*1..3]->() RETURN v.name + MATCH (v:player {name: "Yao Ming"})-[:serve*1..3]->() RETURN v.player.name """ Then the result should be, in any order: - | v.name | - | "Yao Ming" | + | v.player.name | + | "Yao Ming" | When executing query: """ - MATCH (v:player {name: "Yao Ming"})-[:serve*2..3]->() RETURN v.name + MATCH (v:player {name: "Yao Ming"})-[:serve*2..3]->() RETURN v.player.name """ Then the result should be, in any order: - | v.name | + | v.player.name | When executing query: """ - MATCH (v:player {name: "Yao Ming"})-[:serve*1000000000..1000000002]->() RETURN v.name + MATCH (v:player {name: "Yao Ming"})-[:serve*1000000000..1000000002]->() RETURN v.player.name """ Then the result should be, in any order: - | v.name | + | v.player.name | diff --git a/tests/tck/features/match/With.feature b/tests/tck/features/match/With.feature index 49a8204a307..887d6aa002e 100644 --- a/tests/tck/features/match/With.feature +++ b/tests/tck/features/match/With.feature @@ -69,7 +69,7 @@ Feature: With clause When executing query: """ MATCH (v :player{name:"Tim Duncan"})-[]-(v2) - WITH avg(v2.age) as average_age + WITH avg(v2.player.age) as average_age RETURN average_age """ Then the result should be, in any order, with relax comparison: @@ -78,26 +78,35 @@ Feature: With clause When executing query: """ MATCH (v :player{name:"Tim Duncan"})-[]-(v2)-[]-(v3) - WITH v3.name as names + WITH v3.player.name as names RETURN count(names) """ Then the result should be, in any order, with relax comparison: | count(names) | - | 191 | + | 141 | + When executing query: + """ + MATCH (v :player{name:"Tim Duncan"})-[]-(v2)-[]-(v3) + WITH v3.team.name as names + RETURN count(names) + """ + Then the result should be, in any order, with relax comparison: + | count(names) | + | 50 | When executing query: """ MATCH (v :player{name:"Tim Duncan"})-[]-(v2) - WITH distinct(v2.name) AS names + WITH distinct(v2.player.name) AS names ORDER by names DESC LIMIT 5 RETURN collect(names) """ Then the result should be, in any order, with relax comparison: - | collect(names) | - | ["Tony Parker", "Tiago Splitter", "Spurs", "Shaquille O'Neal", "Marco Belinelli"] | + | collect(names) | + | ["Tony Parker", "Tiago Splitter", "Shaquille O'Neal", "Marco Belinelli"] | When profiling query: """ MATCH (v:player) - WITH v.age AS age, v AS v, v.name AS name + WITH v.player.age AS age, v AS v, v.player.name AS name ORDER BY age DESCENDING, name ASCENDING LIMIT 20 WHERE age > 30 @@ -138,13 +147,13 @@ Feature: With clause When executing query: """ MATCH (v:player)-[:like]->(v2) - WHERE v.name == "Tony Parker" and v2.age == 42 - WITH *, v.age + 100 AS age - RETURN *, v2.name + WHERE v.player.name == "Tony Parker" and v2.player.age == 42 + WITH *, v.player.age + 100 AS age + RETURN *, v2.player.name """ Then the result should be, in any order, with relax comparison: - | v | v2 | age | v2.name | - | ("Tony Parker" :player{age: 36, name: "Tony Parker"}) | ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) | 136 | "Tim Duncan" | + | v | v2 | age | v2.player.name | + | ("Tony Parker" :player{age: 36, name: "Tony Parker"}) | ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) | 136 | "Tim Duncan" | When executing query: """ MATCH (:player)-[:like]->() @@ -183,7 +192,7 @@ Feature: With clause """ WITH "Tony Parker" AS a MATCH (v:player{name: a}) - RETURN v.age AS age + RETURN v.player.age AS age """ Then the result should be, in any order, with relax comparison: | age | diff --git a/tests/tck/features/match/ZeroStep.feature b/tests/tck/features/match/ZeroStep.feature index cbd0ba0a6f0..e692b4ed7bc 100644 --- a/tests/tck/features/match/ZeroStep.feature +++ b/tests/tck/features/match/ZeroStep.feature @@ -323,53 +323,53 @@ Feature: Variable length Pattern match (0 step) When executing query: """ MATCH (v) -[*0..1]-(v2:player{name: "Tim Duncan"})-[e*1..2]->(v3) - RETURN DISTINCT v3.name AS Name, e ORDER BY Name + RETURN DISTINCT v3.player.name AS pName, v3.team.name as tName, e ORDER BY pName """ Then the result should be, in any order: - | Name | e | - | "Cavaliers" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:serve "Danny Green"->"Cavaliers" @0 {end_year: 2010, start_year: 2009}]] | - | "Danny Green" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}]] | - | "Hornets" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:serve "Tony Parker"->"Hornets" @0 {end_year: 2019, start_year: 2018}]] | - | "Hornets" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:serve "Tony Parker"->"Hornets" @0 {end_year: 2019, start_year: 2018}]] | - | "Kyle Anderson" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:teammate "Tony Parker"->"Kyle Anderson" @0 {end_year: 2016, start_year: 2014}]] | - | "Kyle Anderson" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:teammate "Tony Parker"->"Kyle Anderson" @0 {end_year: 2016, start_year: 2014}]] | - | "LaMarcus Aldridge" | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}]] | - | "LaMarcus Aldridge" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:teammate "Tony Parker"->"LaMarcus Aldridge" @0 {end_year: 2018, start_year: 2015}]] | - | "LaMarcus Aldridge" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:teammate "Tony Parker"->"LaMarcus Aldridge" @0 {end_year: 2018, start_year: 2015}]] | - | "LaMarcus Aldridge" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:like "Tony Parker"->"LaMarcus Aldridge" @0 {likeness: 90}]] | - | "LaMarcus Aldridge" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:like "Tony Parker"->"LaMarcus Aldridge" @0 {likeness: 90}]] | - | "LeBron James" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:like "Danny Green"->"LeBron James" @0 {likeness: 80}]] | - | "Manu Ginobili" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:teammate "Tony Parker"->"Manu Ginobili" @0 {end_year: 2018, start_year: 2002}]] | - | "Manu Ginobili" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:like "Tony Parker"->"Manu Ginobili" @0 {likeness: 95}]] | - | "Manu Ginobili" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:like "Tony Parker"->"Manu Ginobili" @0 {likeness: 95}]] | - | "Manu Ginobili" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:teammate "Tony Parker"->"Manu Ginobili" @0 {end_year: 2018, start_year: 2002}]] | - | "Manu Ginobili" | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}]] | - | "Manu Ginobili" | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}]] | - | "Marco Belinelli" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:like "Danny Green"->"Marco Belinelli" @0 {likeness: 83}]] | - | "Raptors" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:serve "Danny Green"->"Raptors" @0 {end_year: 2019, start_year: 2018}]] | - | "Spurs" | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}], [:serve "Manu Ginobili"->"Spurs" @0 {end_year: 2018, start_year: 2002}]] | - | "Spurs" | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}], [:serve "Manu Ginobili"->"Spurs" @0 {end_year: 2018, start_year: 2002}]] | - | "Spurs" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:serve "Tony Parker"->"Spurs" @0 {end_year: 2018, start_year: 1999}]] | - | "Spurs" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:serve "Tony Parker"->"Spurs" @0 {end_year: 2018, start_year: 1999}]] | - | "Spurs" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:serve "Danny Green"->"Spurs" @0 {end_year: 2018, start_year: 2010}]] | - | "Spurs" | [[:serve "Tim Duncan"->"Spurs" @0 {end_year: 2016, start_year: 1997}]] | - | "Spurs" | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}], [:serve "LaMarcus Aldridge"->"Spurs" @0 {end_year: 2019, start_year: 2015}]] | - | "Tim Duncan" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:like "Danny Green"->"Tim Duncan" @0 {likeness: 70}]] | - | "Tim Duncan" | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}], [:like "Manu Ginobili"->"Tim Duncan" @0 {likeness: 90}]] | - | "Tim Duncan" | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}], [:like "Manu Ginobili"->"Tim Duncan" @0 {likeness: 90}]] | - | "Tim Duncan" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:teammate "Tony Parker"->"Tim Duncan" @0 {end_year: 2016, start_year: 2001}]] | - | "Tim Duncan" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:teammate "Tony Parker"->"Tim Duncan" @0 {end_year: 2016, start_year: 2001}]] | - | "Tim Duncan" | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}], [:teammate "Manu Ginobili"->"Tim Duncan" @0 {end_year: 2016, start_year: 2002}]] | - | "Tim Duncan" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:like "Tony Parker"->"Tim Duncan" @0 {likeness: 95}]] | - | "Tim Duncan" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:like "Tony Parker"->"Tim Duncan" @0 {likeness: 95}]] | - | "Tim Duncan" | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}], [:teammate "Manu Ginobili"->"Tim Duncan" @0 {end_year: 2016, start_year: 2002}]] | - | "Tim Duncan" | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}], [:like "LaMarcus Aldridge"->"Tim Duncan" @0 {likeness: 75}]] | - | "Tony Parker" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}]] | - | "Tony Parker" | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}], [:like "LaMarcus Aldridge"->"Tony Parker" @0 {likeness: 75}]] | - | "Tony Parker" | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}], [:teammate "Manu Ginobili"->"Tony Parker" @0 {end_year: 2016, start_year: 2002}]] | - | "Tony Parker" | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}], [:teammate "Manu Ginobili"->"Tony Parker" @0 {end_year: 2016, start_year: 2002}]] | - | "Tony Parker" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}]] | - | "Trail Blazers" | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}], [:serve "LaMarcus Aldridge"->"Trail Blazers" @0 {end_year: 2015, start_year: 2006}]] | + | pName | tName | e | + | "Danny Green" | NULL | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}]] | + | "Kyle Anderson" | NULL | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:teammate "Tony Parker"->"Kyle Anderson" @0 {end_year: 2016, start_year: 2014}]] | + | "Kyle Anderson" | NULL | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:teammate "Tony Parker"->"Kyle Anderson" @0 {end_year: 2016, start_year: 2014}]] | + | "LaMarcus Aldridge" | NULL | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}]] | + | "LaMarcus Aldridge" | NULL | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:like "Tony Parker"->"LaMarcus Aldridge" @0 {likeness: 90}]] | + | "LaMarcus Aldridge" | NULL | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:like "Tony Parker"->"LaMarcus Aldridge" @0 {likeness: 90}]] | + | "LaMarcus Aldridge" | NULL | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:teammate "Tony Parker"->"LaMarcus Aldridge" @0 {end_year: 2018, start_year: 2015}]] | + | "LaMarcus Aldridge" | NULL | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:teammate "Tony Parker"->"LaMarcus Aldridge" @0 {end_year: 2018, start_year: 2015}]] | + | "LeBron James" | NULL | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:like "Danny Green"->"LeBron James" @0 {likeness: 80}]] | + | "Manu Ginobili" | NULL | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}]] | + | "Manu Ginobili" | NULL | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:like "Tony Parker"->"Manu Ginobili" @0 {likeness: 95}]] | + | "Manu Ginobili" | NULL | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:like "Tony Parker"->"Manu Ginobili" @0 {likeness: 95}]] | + | "Manu Ginobili" | NULL | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:teammate "Tony Parker"->"Manu Ginobili" @0 {end_year: 2018, start_year: 2002}]] | + | "Manu Ginobili" | NULL | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:teammate "Tony Parker"->"Manu Ginobili" @0 {end_year: 2018, start_year: 2002}]] | + | "Manu Ginobili" | NULL | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}]] | + | "Marco Belinelli" | NULL | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:like "Danny Green"->"Marco Belinelli" @0 {likeness: 83}]] | + | "Tim Duncan" | NULL | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}], [:teammate "Manu Ginobili"->"Tim Duncan" @0 {end_year: 2016, start_year: 2002}]] | + | "Tim Duncan" | NULL | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}], [:like "LaMarcus Aldridge"->"Tim Duncan" @0 {likeness: 75}]] | + | "Tim Duncan" | NULL | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:teammate "Tony Parker"->"Tim Duncan" @0 {end_year: 2016, start_year: 2001}]] | + | "Tim Duncan" | NULL | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:teammate "Tony Parker"->"Tim Duncan" @0 {end_year: 2016, start_year: 2001}]] | + | "Tim Duncan" | NULL | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:like "Tony Parker"->"Tim Duncan" @0 {likeness: 95}]] | + | "Tim Duncan" | NULL | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:like "Danny Green"->"Tim Duncan" @0 {likeness: 70}]] | + | "Tim Duncan" | NULL | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:like "Tony Parker"->"Tim Duncan" @0 {likeness: 95}]] | + | "Tim Duncan" | NULL | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}], [:like "Manu Ginobili"->"Tim Duncan" @0 {likeness: 90}]] | + | "Tim Duncan" | NULL | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}], [:like "Manu Ginobili"->"Tim Duncan" @0 {likeness: 90}]] | + | "Tim Duncan" | NULL | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}], [:teammate "Manu Ginobili"->"Tim Duncan" @0 {end_year: 2016, start_year: 2002}]] | + | "Tony Parker" | NULL | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}], [:teammate "Manu Ginobili"->"Tony Parker" @0 {end_year: 2016, start_year: 2002}]] | + | "Tony Parker" | NULL | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}]] | + | "Tony Parker" | NULL | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}]] | + | "Tony Parker" | NULL | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}], [:teammate "Manu Ginobili"->"Tony Parker" @0 {end_year: 2016, start_year: 2002}]] | + | "Tony Parker" | NULL | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}], [:like "LaMarcus Aldridge"->"Tony Parker" @0 {likeness: 75}]] | + | NULL | "Cavaliers" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:serve "Danny Green"->"Cavaliers" @0 {end_year: 2010, start_year: 2009}]] | + | NULL | "Spurs" | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}], [:serve "Manu Ginobili"->"Spurs" @0 {end_year: 2018, start_year: 2002}]] | + | NULL | "Spurs" | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}], [:serve "Manu Ginobili"->"Spurs" @0 {end_year: 2018, start_year: 2002}]] | + | NULL | "Spurs" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:serve "Danny Green"->"Spurs" @0 {end_year: 2018, start_year: 2010}]] | + | NULL | "Spurs" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:serve "Tony Parker"->"Spurs" @0 {end_year: 2018, start_year: 1999}]] | + | NULL | "Spurs" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:serve "Tony Parker"->"Spurs" @0 {end_year: 2018, start_year: 1999}]] | + | NULL | "Spurs" | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}], [:serve "LaMarcus Aldridge"->"Spurs" @0 {end_year: 2019, start_year: 2015}]] | + | NULL | "Hornets" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:serve "Tony Parker"->"Hornets" @0 {end_year: 2019, start_year: 2018}]] | + | NULL | "Hornets" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:serve "Tony Parker"->"Hornets" @0 {end_year: 2019, start_year: 2018}]] | + | NULL | "Spurs" | [[:serve "Tim Duncan"->"Spurs" @0 {end_year: 2016, start_year: 1997}]] | + | NULL | "Trail Blazers" | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}], [:serve "LaMarcus Aldridge"->"Trail Blazers" @0 {end_year: 2015, start_year: 2006}]] | + | NULL | "Raptors" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:serve "Danny Green"->"Raptors" @0 {end_year: 2019, start_year: 2018}]] | When executing query: """ MATCH (v) -[e1*0..1{likeness: 90}]-(v2:player{name: "Tony Parker"})-[*1..2]->(v3) diff --git a/tests/tck/features/match/ZeroStep.intVid.feature b/tests/tck/features/match/ZeroStep.intVid.feature index 457fda55f0e..b637056936b 100644 --- a/tests/tck/features/match/ZeroStep.intVid.feature +++ b/tests/tck/features/match/ZeroStep.intVid.feature @@ -323,53 +323,53 @@ Feature: Variable length Pattern match int vid (0 step) When executing query: """ MATCH (v) -[*0..1]-(v2:player{name: "Tim Duncan"})-[e*1..2]->(v3) - RETURN DISTINCT v3.name AS Name, e ORDER BY Name + RETURN DISTINCT v3.player.name AS pName, v3.team.name as tName, e ORDER BY pName """ Then the result should be, in any order: - | Name | e | - | "Cavaliers" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:serve "Danny Green"->"Cavaliers" @0 {end_year: 2010, start_year: 2009}]] | - | "Danny Green" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}]] | - | "Hornets" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:serve "Tony Parker"->"Hornets" @0 {end_year: 2019, start_year: 2018}]] | - | "Hornets" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:serve "Tony Parker"->"Hornets" @0 {end_year: 2019, start_year: 2018}]] | - | "Kyle Anderson" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:teammate "Tony Parker"->"Kyle Anderson" @0 {end_year: 2016, start_year: 2014}]] | - | "Kyle Anderson" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:teammate "Tony Parker"->"Kyle Anderson" @0 {end_year: 2016, start_year: 2014}]] | - | "LaMarcus Aldridge" | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}]] | - | "LaMarcus Aldridge" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:teammate "Tony Parker"->"LaMarcus Aldridge" @0 {end_year: 2018, start_year: 2015}]] | - | "LaMarcus Aldridge" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:teammate "Tony Parker"->"LaMarcus Aldridge" @0 {end_year: 2018, start_year: 2015}]] | - | "LaMarcus Aldridge" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:like "Tony Parker"->"LaMarcus Aldridge" @0 {likeness: 90}]] | - | "LaMarcus Aldridge" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:like "Tony Parker"->"LaMarcus Aldridge" @0 {likeness: 90}]] | - | "LeBron James" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:like "Danny Green"->"LeBron James" @0 {likeness: 80}]] | - | "Manu Ginobili" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:teammate "Tony Parker"->"Manu Ginobili" @0 {end_year: 2018, start_year: 2002}]] | - | "Manu Ginobili" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:like "Tony Parker"->"Manu Ginobili" @0 {likeness: 95}]] | - | "Manu Ginobili" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:like "Tony Parker"->"Manu Ginobili" @0 {likeness: 95}]] | - | "Manu Ginobili" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:teammate "Tony Parker"->"Manu Ginobili" @0 {end_year: 2018, start_year: 2002}]] | - | "Manu Ginobili" | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}]] | - | "Manu Ginobili" | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}]] | - | "Marco Belinelli" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:like "Danny Green"->"Marco Belinelli" @0 {likeness: 83}]] | - | "Raptors" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:serve "Danny Green"->"Raptors" @0 {end_year: 2019, start_year: 2018}]] | - | "Spurs" | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}], [:serve "Manu Ginobili"->"Spurs" @0 {end_year: 2018, start_year: 2002}]] | - | "Spurs" | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}], [:serve "Manu Ginobili"->"Spurs" @0 {end_year: 2018, start_year: 2002}]] | - | "Spurs" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:serve "Tony Parker"->"Spurs" @0 {end_year: 2018, start_year: 1999}]] | - | "Spurs" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:serve "Tony Parker"->"Spurs" @0 {end_year: 2018, start_year: 1999}]] | - | "Spurs" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:serve "Danny Green"->"Spurs" @0 {end_year: 2018, start_year: 2010}]] | - | "Spurs" | [[:serve "Tim Duncan"->"Spurs" @0 {end_year: 2016, start_year: 1997}]] | - | "Spurs" | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}], [:serve "LaMarcus Aldridge"->"Spurs" @0 {end_year: 2019, start_year: 2015}]] | - | "Tim Duncan" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:like "Danny Green"->"Tim Duncan" @0 {likeness: 70}]] | - | "Tim Duncan" | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}], [:like "Manu Ginobili"->"Tim Duncan" @0 {likeness: 90}]] | - | "Tim Duncan" | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}], [:like "Manu Ginobili"->"Tim Duncan" @0 {likeness: 90}]] | - | "Tim Duncan" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:teammate "Tony Parker"->"Tim Duncan" @0 {end_year: 2016, start_year: 2001}]] | - | "Tim Duncan" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:teammate "Tony Parker"->"Tim Duncan" @0 {end_year: 2016, start_year: 2001}]] | - | "Tim Duncan" | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}], [:teammate "Manu Ginobili"->"Tim Duncan" @0 {end_year: 2016, start_year: 2002}]] | - | "Tim Duncan" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:like "Tony Parker"->"Tim Duncan" @0 {likeness: 95}]] | - | "Tim Duncan" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:like "Tony Parker"->"Tim Duncan" @0 {likeness: 95}]] | - | "Tim Duncan" | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}], [:teammate "Manu Ginobili"->"Tim Duncan" @0 {end_year: 2016, start_year: 2002}]] | - | "Tim Duncan" | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}], [:like "LaMarcus Aldridge"->"Tim Duncan" @0 {likeness: 75}]] | - | "Tony Parker" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}]] | - | "Tony Parker" | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}], [:like "LaMarcus Aldridge"->"Tony Parker" @0 {likeness: 75}]] | - | "Tony Parker" | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}], [:teammate "Manu Ginobili"->"Tony Parker" @0 {end_year: 2016, start_year: 2002}]] | - | "Tony Parker" | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}], [:teammate "Manu Ginobili"->"Tony Parker" @0 {end_year: 2016, start_year: 2002}]] | - | "Tony Parker" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}]] | - | "Trail Blazers" | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}], [:serve "LaMarcus Aldridge"->"Trail Blazers" @0 {end_year: 2015, start_year: 2006}]] | + | pName | tName | e | + | "Danny Green" | NULL | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}]] | + | "Kyle Anderson" | NULL | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:teammate "Tony Parker"->"Kyle Anderson" @0 {end_year: 2016, start_year: 2014}]] | + | "Kyle Anderson" | NULL | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:teammate "Tony Parker"->"Kyle Anderson" @0 {end_year: 2016, start_year: 2014}]] | + | "LaMarcus Aldridge" | NULL | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}]] | + | "LaMarcus Aldridge" | NULL | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:like "Tony Parker"->"LaMarcus Aldridge" @0 {likeness: 90}]] | + | "LaMarcus Aldridge" | NULL | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:like "Tony Parker"->"LaMarcus Aldridge" @0 {likeness: 90}]] | + | "LaMarcus Aldridge" | NULL | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:teammate "Tony Parker"->"LaMarcus Aldridge" @0 {end_year: 2018, start_year: 2015}]] | + | "LaMarcus Aldridge" | NULL | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:teammate "Tony Parker"->"LaMarcus Aldridge" @0 {end_year: 2018, start_year: 2015}]] | + | "LeBron James" | NULL | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:like "Danny Green"->"LeBron James" @0 {likeness: 80}]] | + | "Manu Ginobili" | NULL | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}]] | + | "Manu Ginobili" | NULL | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:like "Tony Parker"->"Manu Ginobili" @0 {likeness: 95}]] | + | "Manu Ginobili" | NULL | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:like "Tony Parker"->"Manu Ginobili" @0 {likeness: 95}]] | + | "Manu Ginobili" | NULL | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:teammate "Tony Parker"->"Manu Ginobili" @0 {end_year: 2018, start_year: 2002}]] | + | "Manu Ginobili" | NULL | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:teammate "Tony Parker"->"Manu Ginobili" @0 {end_year: 2018, start_year: 2002}]] | + | "Manu Ginobili" | NULL | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}]] | + | "Marco Belinelli" | NULL | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:like "Danny Green"->"Marco Belinelli" @0 {likeness: 83}]] | + | "Tim Duncan" | NULL | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}], [:teammate "Manu Ginobili"->"Tim Duncan" @0 {end_year: 2016, start_year: 2002}]] | + | "Tim Duncan" | NULL | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}], [:like "LaMarcus Aldridge"->"Tim Duncan" @0 {likeness: 75}]] | + | "Tim Duncan" | NULL | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:teammate "Tony Parker"->"Tim Duncan" @0 {end_year: 2016, start_year: 2001}]] | + | "Tim Duncan" | NULL | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:teammate "Tony Parker"->"Tim Duncan" @0 {end_year: 2016, start_year: 2001}]] | + | "Tim Duncan" | NULL | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:like "Tony Parker"->"Tim Duncan" @0 {likeness: 95}]] | + | "Tim Duncan" | NULL | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:like "Danny Green"->"Tim Duncan" @0 {likeness: 70}]] | + | "Tim Duncan" | NULL | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:like "Tony Parker"->"Tim Duncan" @0 {likeness: 95}]] | + | "Tim Duncan" | NULL | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}], [:like "Manu Ginobili"->"Tim Duncan" @0 {likeness: 90}]] | + | "Tim Duncan" | NULL | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}], [:like "Manu Ginobili"->"Tim Duncan" @0 {likeness: 90}]] | + | "Tim Duncan" | NULL | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}], [:teammate "Manu Ginobili"->"Tim Duncan" @0 {end_year: 2016, start_year: 2002}]] | + | "Tony Parker" | NULL | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}], [:teammate "Manu Ginobili"->"Tony Parker" @0 {end_year: 2016, start_year: 2002}]] | + | "Tony Parker" | NULL | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}]] | + | "Tony Parker" | NULL | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}]] | + | "Tony Parker" | NULL | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}], [:teammate "Manu Ginobili"->"Tony Parker" @0 {end_year: 2016, start_year: 2002}]] | + | "Tony Parker" | NULL | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}], [:like "LaMarcus Aldridge"->"Tony Parker" @0 {likeness: 75}]] | + | NULL | "Cavaliers" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:serve "Danny Green"->"Cavaliers" @0 {end_year: 2010, start_year: 2009}]] | + | NULL | "Spurs" | [[:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}], [:serve "Manu Ginobili"->"Spurs" @0 {end_year: 2018, start_year: 2002}]] | + | NULL | "Spurs" | [[:teammate "Tim Duncan"->"Manu Ginobili" @0 {end_year: 2016, start_year: 2002}], [:serve "Manu Ginobili"->"Spurs" @0 {end_year: 2018, start_year: 2002}]] | + | NULL | "Spurs" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:serve "Danny Green"->"Spurs" @0 {end_year: 2018, start_year: 2010}]] | + | NULL | "Spurs" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:serve "Tony Parker"->"Spurs" @0 {end_year: 2018, start_year: 1999}]] | + | NULL | "Spurs" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:serve "Tony Parker"->"Spurs" @0 {end_year: 2018, start_year: 1999}]] | + | NULL | "Spurs" | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}], [:serve "LaMarcus Aldridge"->"Spurs" @0 {end_year: 2019, start_year: 2015}]] | + | NULL | "Hornets" | [[:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}], [:serve "Tony Parker"->"Hornets" @0 {end_year: 2019, start_year: 2018}]] | + | NULL | "Hornets" | [[:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}], [:serve "Tony Parker"->"Hornets" @0 {end_year: 2019, start_year: 2018}]] | + | NULL | "Spurs" | [[:serve "Tim Duncan"->"Spurs" @0 {end_year: 2016, start_year: 1997}]] | + | NULL | "Trail Blazers" | [[:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}], [:serve "LaMarcus Aldridge"->"Trail Blazers" @0 {end_year: 2015, start_year: 2006}]] | + | NULL | "Raptors" | [[:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}], [:serve "Danny Green"->"Raptors" @0 {end_year: 2019, start_year: 2018}]] | When executing query: """ MATCH (v) -[e1*0..1{likeness: 90}]-(v2:player{name: "Tony Parker"})-[*1..2]->(v3) diff --git a/tests/tck/features/optimizer/CollapseProjectRule.feature b/tests/tck/features/optimizer/CollapseProjectRule.feature index 4d65cb3686b..ea6f339a162 100644 --- a/tests/tck/features/optimizer/CollapseProjectRule.feature +++ b/tests/tck/features/optimizer/CollapseProjectRule.feature @@ -10,8 +10,8 @@ Feature: Collapse Project Rule When profiling query: """ MATCH (v:player) - WHERE v.age > 38 - WITH v, v.age AS age, v.age/10 AS iage, v.age%10 AS mage,v.name AS name + WHERE v.player.age > 38 + WITH v, v.player.age AS age, v.player.age/10 AS iage, v.player.age%10 AS mage,v.player.name AS name RETURN iage """ Then the result should be, in any order: diff --git a/tests/tck/features/optimizer/CombineFilterRule.feature b/tests/tck/features/optimizer/CombineFilterRule.feature index 08392f5c30f..a76da16625d 100644 --- a/tests/tck/features/optimizer/CombineFilterRule.feature +++ b/tests/tck/features/optimizer/CombineFilterRule.feature @@ -10,7 +10,7 @@ Feature: combine filters When profiling query: """ MATCH (v:player)-[:like]->(n) - WHERE v.age>40 AND n.age>42 + WHERE v.player.age > 40 AND n.player.age > 42 RETURN v, n """ Then the result should be, in any order: diff --git a/tests/tck/features/optimizer/IndexScanRule.feature b/tests/tck/features/optimizer/IndexScanRule.feature index 7a5bf6e5d71..34a19251298 100644 --- a/tests/tck/features/optimizer/IndexScanRule.feature +++ b/tests/tck/features/optimizer/IndexScanRule.feature @@ -10,7 +10,7 @@ Feature: Match index selection When profiling query: """ MATCH (v:player) - WHERE v.name>"Tim Duncan" and v.name<="Yao Ming" + WHERE v.player.name>"Tim Duncan" and v.player.name<="Yao Ming" RETURN v """ Then the result should be, in any order: @@ -29,7 +29,7 @@ Feature: Match index selection When profiling query: """ MATCH (v:player) - WHERE v.age>30 and v.age<=40 + WHERE v.player.age>30 and v.player.age<=40 RETURN v """ Then the result should be, in any order: @@ -71,10 +71,10 @@ Feature: Match index selection """ MATCH (v:player) WHERE - v.name<="Aron Baynes" - or v.name>"Yao Ming" - or v.name=="Kobe Bryant" - or v.age>40 + v.player.name<="Aron Baynes" + or v.player.name>"Yao Ming" + or v.player.name=="Kobe Bryant" + or v.player.age>40 RETURN v """ Then the result should be, in any order: @@ -102,8 +102,8 @@ Feature: Match index selection """ MATCH (v:player)-[:like]->(n) WHERE - v.name<="Aron Baynes" - or n.age>45 + v.player.name<="Aron Baynes" + or n.player.age>45 RETURN v, n """ Then the result should be, in any order: @@ -127,11 +127,11 @@ Feature: Match index selection """ MATCH (v:player)-[:like]->(n) WHERE - v.name<="Aron Baynes" - or v.age>45 + v.player.name<="Aron Baynes" + or v.player.age>45 or true - or v.age+1 - or v.name + or v.player.age+1 + or v.player.name RETURN count(*) AS count """ Then the result should be, in any order: diff --git a/tests/tck/features/optimizer/MergeGetNbrsDedupProjectRule.feature b/tests/tck/features/optimizer/MergeGetNbrsDedupProjectRule.feature index 7eec224d430..ba5cdb3005d 100644 --- a/tests/tck/features/optimizer/MergeGetNbrsDedupProjectRule.feature +++ b/tests/tck/features/optimizer/MergeGetNbrsDedupProjectRule.feature @@ -12,7 +12,7 @@ Feature: merge get neighbors, dedup and project rule When profiling query: """ MATCH (v:player{name: 'Tim Duncan'})-[:like*0..1]->(v2) - RETURN v2.name AS Name + RETURN v2.player.name AS Name """ Then the result should be, in any order: | Name | diff --git a/tests/tck/features/optimizer/MergeGetVerticesDedupProjectRule.feature b/tests/tck/features/optimizer/MergeGetVerticesDedupProjectRule.feature index 02beb81b619..4db69550eca 100644 --- a/tests/tck/features/optimizer/MergeGetVerticesDedupProjectRule.feature +++ b/tests/tck/features/optimizer/MergeGetVerticesDedupProjectRule.feature @@ -13,7 +13,7 @@ Feature: merge get vertices, dedup and project rule """ MATCH (v) WHERE id(v) == 'Tim Duncan' - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | diff --git a/tests/tck/features/optimizer/PushFilterDownAggregateRule.feature b/tests/tck/features/optimizer/PushFilterDownAggregateRule.feature index 13eb496e121..44d5c5fbfca 100644 --- a/tests/tck/features/optimizer/PushFilterDownAggregateRule.feature +++ b/tests/tck/features/optimizer/PushFilterDownAggregateRule.feature @@ -13,8 +13,8 @@ Feature: Push Filter down Aggregate rule """ MATCH (v:player) WITH - v.age+1 AS age, - COUNT(v.age) as count + v.player.age+1 AS age, + COUNT(v.player.age) as count WHERE age<30 RETURN age, count ORDER BY age diff --git a/tests/tck/features/optimizer/PushFilterDownProjectRule.feature b/tests/tck/features/optimizer/PushFilterDownProjectRule.feature index 6b54e7c644f..b1e6e7df325 100644 --- a/tests/tck/features/optimizer/PushFilterDownProjectRule.feature +++ b/tests/tck/features/optimizer/PushFilterDownProjectRule.feature @@ -13,7 +13,7 @@ Feature: Push Filter down Project rule """ MATCH (a:player)--(b)--(c) WITH a AS a, b AS b, c AS c - WHERE a.age < 25 AND b.age < 25 AND c.age < 25 + WHERE a.player.age < 25 AND b.player.age < 25 AND c.player.age < 25 RETURN a """ Then the result should be, in any order: @@ -45,8 +45,8 @@ Feature: Push Filter down Project rule When profiling query: """ MATCH (a:player)--(b)--(c) - WITH a, b, c.age+1 AS cage - WHERE a.name == 'Tim Duncan' AND b.age > 40 + WITH a, b, c.player.age+1 AS cage + WHERE a.player.name == 'Tim Duncan' AND b.player.age > 40 RETURN DISTINCT a, b, cage """ Then the result should be, in any order: diff --git a/tests/tck/features/optimizer/PushLimitDownProjectRule.feature b/tests/tck/features/optimizer/PushLimitDownProjectRule.feature index 4ab978c904d..c792a7147ae 100644 --- a/tests/tck/features/optimizer/PushLimitDownProjectRule.feature +++ b/tests/tck/features/optimizer/PushLimitDownProjectRule.feature @@ -10,7 +10,7 @@ Feature: Push Limit down project rule When profiling query: """ MATCH p=(v:player)-[]->(n) - WHERE id(v)=="Tim Duncan" and n.age>30 + WHERE id(v)=="Tim Duncan" and n.player.age>30 RETURN p LIMIT 100 """ Then the result should be, in any order: diff --git a/tests/tck/features/optimizer/PushLimitDownScanVerticesRule.feature b/tests/tck/features/optimizer/PushLimitDownScanVerticesRule.feature index dd503af4909..a5f219c29e8 100644 --- a/tests/tck/features/optimizer/PushLimitDownScanVerticesRule.feature +++ b/tests/tck/features/optimizer/PushLimitDownScanVerticesRule.feature @@ -10,13 +10,13 @@ Feature: Push Limit down scan vertices rule When profiling query: """ MATCH (v) - RETURN v.name LIMIT 3 + RETURN v.person.name LIMIT 3 """ Then the result should be, in any order: - | v.name | - | /\w+/ | - | /\w+/ | - | /\w+/ | + | v.person.name | + | /\w+/ | + | /\w+/ | + | /\w+/ | And the execution plan should be: | id | name | dependencies | operator info | | 9 | DataCollect | 19 | | @@ -28,13 +28,13 @@ Feature: Push Limit down scan vertices rule When profiling query: """ MATCH (v:person) - RETURN v.name LIMIT 3 + RETURN v.person.name LIMIT 3 """ Then the result should be, in any order: - | v.name | - | /\w+/ | - | /\w+/ | - | /\w+/ | + | v.person.name | + | /\w+/ | + | /\w+/ | + | /\w+/ | And the execution plan should be: | id | name | dependencies | operator info | | 9 | DataCollect | 19 | | diff --git a/tests/tck/features/optimizer/RemoveUselessProjectRule.feature b/tests/tck/features/optimizer/RemoveUselessProjectRule.feature index 894c472ac73..39ca120d8aa 100644 --- a/tests/tck/features/optimizer/RemoveUselessProjectRule.feature +++ b/tests/tck/features/optimizer/RemoveUselessProjectRule.feature @@ -11,8 +11,8 @@ Feature: Remove Useless Project Rule """ MATCH (v:player) WITH - v.age+1 AS age, - count(v.age) AS count + v.player.age+1 AS age, + count(v.player.age) AS count RETURN age, count ORDER BY age, count """ diff --git a/tests/tck/features/parser/Example.feature b/tests/tck/features/parser/Example.feature index 54f86b47d70..a561ea48cd2 100644 --- a/tests/tck/features/parser/Example.feature +++ b/tests/tck/features/parser/Example.feature @@ -14,7 +14,7 @@ Feature: Feature examples When executing query: """ MATCH (v:player{name: "Tim Duncan"}) - RETURN v.name AS Name + RETURN v.player.name AS Name """ Then the result should be, in any order: | Name | diff --git a/tests/tck/features/yield/parameter.feature b/tests/tck/features/yield/parameter.feature index b6031d18083..311f562e60d 100644 --- a/tests/tck/features/yield/parameter.feature +++ b/tests/tck/features/yield/parameter.feature @@ -19,8 +19,8 @@ Feature: Parameter Scenario: cypher with parameters When executing query: """ - MATCH (v:player)-[:like]->(n) WHERE id(v)==$p3 and n.age>$p1+29 - RETURN n.name AS dst LIMIT $p1+1 + MATCH (v:player)-[:like]->(n) WHERE id(v)==$p3 and n.player.age>$p1+29 + RETURN n.player.name AS dst LIMIT $p1+1 """ Then the result should be, in any order: | dst | @@ -29,7 +29,7 @@ Feature: Parameter When executing query: """ MATCH (v:player)-[:like]->(n{name:$p7.a.b.c}) - RETURN n.name AS dst LIMIT $p7.a.b.d[0] + RETURN n.player.name AS dst LIMIT $p7.a.b.d[0] """ Then the result should be, in any order: | dst | @@ -57,8 +57,8 @@ Feature: Parameter When executing query: """ MATCH (v:player) - WITH v AS v WHERE v.name in [$p1,$p2,$p3,"Tony Parker",$p4,$p5,$p6] - RETURN v.name AS v ORDER BY v, $p3 LIMIT $p1 + WITH v AS v WHERE v.player.name in [$p1,$p2,$p3,"Tony Parker",$p4,$p5,$p6] + RETURN v.player.name AS v ORDER BY v, $p3 LIMIT $p1 """ Then the result should be, in order: | v |