Conversation
multi match init
| @@ -2640,9 +2640,8 @@ void AlgoFuncV2::ShortestPath(RTContext *ctx, const Record *record, const cypher | |||
| std::vector<cypher::Record> *records) { | |||
There was a problem hiding this comment.
const std::vectorcypher::Record &records
There was a problem hiding this comment.
records是ShortestPath函数的返回值,在函数内写入结果的
| MATCH (n1:Loc {name:'A'}), (n2:Loc {name:'E'}) CALL algo.allShortestPaths(n1, n2) YIELD nodeIds,relationshipIds,cost WITH nodeIds,relationshipIds,cost UNWIND relationshipIds AS rid CALL algo.native.extract(rid, {isNode:false, field:'cost'}) YIELD value RETURN value; | ||
| MATCH (n1:Loc {name:'A'}), (n2:Loc {name:'E'}) CALL algo.allShortestPaths(n1, n2, {relationshipQuery:[{label:'ROAD'}]}) YIELD nodeIds,relationshipIds WITH nodeIds,relationshipIds UNWIND relationshipIds AS rid CALL algo.native.extract(rid, {isNode:false, field:'cost'}) YIELD value RETURN nodeIds, sum(value) AS score; | ||
| MATCH (n1:Loc {name:'A'}), (n2:Loc {name:'E'}) CALL algo.allShortestPaths(n1, n2, {relationshipQuery:[{label:'ROAD'}]}) YIELD nodeIds,relationshipIds,cost WITH nodeIds,relationshipIds,cost UNWIND relationshipIds AS rid CALL algo.native.extract(rid, {isNode:false, field:'cost'}) YIELD value WITH nodeIds, sum(value) AS score CALL algo.native.extract(nodeIds, {isNode:true, field:'name'}) YIELD value RETURN value, score; | ||
| MATCH (n1:Loc {name:'A'}), (n2:Loc {name:'E'}) CALL algo.allShortestPaths(n1, n2, {relationshipQuery:'ROAD') YIELD nodeIds,relationshipIds,cost WITH nodeIds,relationshipIds,cost UNWIND relationshipIds AS rid CALL algo.native.extract(rid, {isNode:false, field:'cost'}) YIELD value WITH nodeIds, sum(value) AS score CALL algo.native.extract(nodeIds, {isNode:true, field:'name'}) YIELD value RETURN value, score; No newline at end of file |
There was a problem hiding this comment.
这个看起来除了参数不一样,其他都和上面一样,并且参数还有错,以为是有人改的时候写多了,就删掉了,已经恢复
|
LGTM |
| // std::string dir = test_suite_dir_ + "/query/cypher"; | ||
| // test_files(dir); | ||
| // } | ||
| TEST_F(TestCypherV2, TestQuery) { |
There was a problem hiding this comment.
可以考虑用GTEST_SKIP来跳过测例,比用注释更好
There was a problem hiding this comment.
当时考虑的是注释看起来更清楚,这些都要跑通,早晚会都打开,用GTEST_SKIP怕有遗漏
| public: | ||
| YieldField() : AstNode(AstNodeType::kYieldField) {} | ||
| public: | ||
| YieldField() : AstNode(AstNodeType::kYieldField), predicate_(nullptr) {} |
There was a problem hiding this comment.
”我们“现在的实现会让生成的AST或者plan没有任何空指针 。
比如说predicate,默认值就是VBool(true)。
提供一点想法,这里不一定要改(要改的话其他地方都要一致(
There was a problem hiding this comment.
目前Geax AstNode里还都是用空指针做的,后续可以做这一步,甚至想把std::any换掉,这块不是很好用
| auto expr = std::any_cast<Entry>(node->expr()->accept(*this)); | ||
| return Entry(cypher::FieldData(expr.GetEntityField(ctx_, node->fieldName()))); | ||
| auto field = expr.GetEntityField(ctx_, node->fieldName()); | ||
| return Entry(cypher::FieldData(field)); |
| SWITCH_CONTEXT_VISIT(ctx->oC_Expression(), update); | ||
| } else { | ||
| NOT_SUPPORT_AND_THROW(); | ||
| THROW_CODE(InputError, FMA_FMT("Variable `{}` not defined", vstr->val())); |
There was a problem hiding this comment.
set 寓意中set后面应该跟着一个属性或者变量,比如 set n.id = 100, 或者 set n.id = m.id 或者 set n = m等,如果SET a :MyLabel 这种情况,之前的实现里是抛出了这个异常
| checkedCast(expr, str); | ||
| std::string field = str->val(); | ||
| if (expr->type() != geax::frontend::AstNodeType::kRef) { | ||
| THROW_CODE(InputError, "Type mismatch: expected Node, Path or Relationship"); |
There was a problem hiding this comment.
delete的语义里delete删除的应该是个点或者边,在语法解析的时候点和边都应该是Ref类型表达式,不是Ref类型表达式应该提示用户 这里期望一个点或者边
Fix bugs, run through test_procedure, test_algo, test_query, test_fix_crash_issue and other test cases