Skip to content

Tail branch#581

Merged
jiazhenjiang merged 58 commits intoTuGraph-family:masterfrom
jiazhenjiang:tail_branch
Jul 12, 2024
Merged

Tail branch#581
jiazhenjiang merged 58 commits intoTuGraph-family:masterfrom
jiazhenjiang:tail_branch

Conversation

@jiazhenjiang
Copy link
Contributor

Fix bugs, run through test_procedure, test_algo, test_query, test_fix_crash_issue and other test cases

@@ -2640,9 +2640,8 @@ void AlgoFuncV2::ShortestPath(RTContext *ctx, const Record *record, const cypher
std::vector<cypher::Record> *records) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const std::vectorcypher::Record &records

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个为什么删掉了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个看起来除了参数不一样,其他都和上面一样,并且参数还有错,以为是有人改的时候写多了,就删掉了,已经恢复

@ljcui
Copy link
Collaborator

ljcui commented Jul 9, 2024

LGTM

// std::string dir = test_suite_dir_ + "/query/cypher";
// test_files(dir);
// }
TEST_F(TestCypherV2, TestQuery) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以考虑用GTEST_SKIP来跳过测例,比用注释更好

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当时考虑的是注释看起来更清楚,这些都要跑通,早晚会都打开,用GTEST_SKIP怕有遗漏

public:
YieldField() : AstNode(AstNodeType::kYieldField) {}
public:
YieldField() : AstNode(AstNodeType::kYieldField), predicate_(nullptr) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

”我们“现在的实现会让生成的AST或者plan没有任何空指针 。
比如说predicate,默认值就是VBool(true)。
提供一点想法,这里不一定要改(要改的话其他地方都要一致(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前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));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里拆分有什么深意?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已恢复

SWITCH_CONTEXT_VISIT(ctx->oC_Expression(), update);
} else {
NOT_SUPPORT_AND_THROW();
THROW_CODE(InputError, FMA_FMT("Variable `{}` not defined", vstr->val()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里没明白

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里没明白

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete的语义里delete删除的应该是个点或者边,在语法解析的时候点和边都应该是Ref类型表达式,不是Ref类型表达式应该提示用户 这里期望一个点或者边

@spasserby spasserby enabled auto-merge (squash) July 11, 2024 02:17
@spasserby spasserby disabled auto-merge July 11, 2024 02:17
@jiazhenjiang jiazhenjiang merged commit c61ff19 into TuGraph-family:master Jul 12, 2024
@jiazhenjiang jiazhenjiang deleted the tail_branch branch July 12, 2024 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants