Conversation
multi match init
| [{"content":"Rachel Kempson","n":{"identity":0,"label":"Person","properties":{"birthyear":1910,"name":"Rachel Kempson"}}},{"content":"Michael Redgrave","n":{"identity":1,"label":"Person","properties":{"birthyear":1908,"name":"Michael Redgrave"}}},{"content":"Vanessa Redgrave","n":{"identity":2,"label":"Person","properties":{"birthyear":1937,"name":"Vanessa Redgrave"}}},{"content":"Corin Redgrave","n":{"identity":3,"label":"Person","properties":{"birthyear":1939,"name":"Corin Redgrave"}}},{"content":"Liam Neeson","n":{"identity":4,"label":"Person","properties":{"birthyear":1952,"name":"Liam Neeson"}}},{"content":"Natasha Richardson","n":{"identity":5,"label":"Person","properties":{"birthyear":1963,"name":"Natasha Richardson"}}},{"content":"Richard Harris","n":{"identity":6,"label":"Person","properties":{"birthyear":1930,"name":"Richard Harris"}}},{"content":"Dennis Quaid","n":{"identity":7,"label":"Person","properties":{"birthyear":1954,"name":"Dennis Quaid"}}},{"content":"Lindsay Lohan","n":{"identity":8,"label":"Person","properties":{"birthyear":1986,"name":"Lindsay Lohan"}}},{"content":"Jemma Redgrave","n":{"identity":9,"label":"Person","properties":{"birthyear":1965,"name":"Jemma Redgrave"}}},{"content":"Roy Redgrave","n":{"identity":10,"label":"Person","properties":{"birthyear":1873,"name":"Roy Redgrave"}}},{"content":"John Williams","n":{"identity":11,"label":"Person","properties":{"birthyear":1932,"name":"John Williams"}}},{"content":"Christopher Nolan","n":{"identity":12,"label":"Person","properties":{"birthyear":1970,"name":"Christopher Nolan"}}},{"content":"New York","n":{"identity":13,"label":"City","properties":{"name":"New York"}}},{"content":"London","n":{"identity":14,"label":"City","properties":{"name":"London"}}},{"content":"Houston","n":{"identity":15,"label":"City","properties":{"name":"Houston"}}},{"content":"Goodbye, Mr. Chips","n":{"identity":16,"label":"Film","properties":{"title":"Goodbye, Mr. Chips"}}},{"content":"Batman Begins","n":{"identity":17,"label":"Film","properties":{"title":"Batman Begins"}}},{"content":"Harry Potter and the Sorcerer's Stone","n":{"identity":18,"label":"Film","properties":{"title":"Harry Potter and the Sorcerer's Stone"}}},{"content":"The Parent Trap","n":{"identity":19,"label":"Film","properties":{"title":"The Parent Trap"}}},{"content":"Camelot","n":{"identity":20,"label":"Film","properties":{"title":"Camelot"}}}] | ||
| MATCH (n {name:'Rachel Kempson'}) RETURN exists((n)-[]->()) /*true*/; | ||
| [{"{EXISTS(NestedPattern(n,@ANON_N1))}":true}] | ||
| [{"exists((n)-[]->())":true}] |
There was a problem hiding this comment.
exists中最后一条就是where的例子,已经通过了
| [{"exists((n)-[]->())":true}] | ||
| MATCH (n {name:'Rachel Kempson'}) RETURN exists((n)-[]->(:Person)) /*true*/; | ||
| [{"{EXISTS(NestedPattern(n,@ANON_N1))}":true}] | ||
| [{"exists((n)-[]->(:Person))":true}] |
There was a problem hiding this comment.
match (a),(b) where not (a)-->(b) return a,b 这种支持吗(不带exists)
There was a problem hiding this comment.
目前还不支持,Geax里path并不是个表达式,不能直接放入filter中,要支持这个语句,可以在构造Geax AstNode的时候手动补个Exists,或者扩展Geax AstNode支持path类型的表达式,这个要做的话可以加一下
src/core/vertex_index.h
Outdated
| */ | ||
| bool Next(); | ||
|
|
||
| bool Goto(lgraph::VertexId vid); |
There was a problem hiding this comment.
统一一下 bool Goto(VertexId vid);
| ++filter_level_; | ||
| } | ||
| std::reverse(expand_ops.begin(), expand_ops.end()); | ||
| if (ClauseGuard::InClause(geax::frontend::AstNodeType::kExists, cur_types_)) { |
There was a problem hiding this comment.
这一段逻辑处理的是什么子句,举个cypher语句例子
There was a problem hiding this comment.
这段逻辑是在处理 exists部分,用limit和optional算子模拟semiapply。类似下面的查询
MATCH (n {name:'Rachel Kempson'}),(m:City) RETURN exists((n)-[:HAS_CHILD]->()-[:BORN_IN]->(m)) /1 true/;
MATCH (n:Person)-[:BORN_IN]->(c) WHERE exists((n)-[:HAS_CHILD]->()-[:BORN_IN]->(c)) RETURN n,c;
There was a problem hiding this comment.
cypher :
MATCH (n {name:'Rachel Kempson'}) RETURN exists((n)-[:MARRIED]->()-[:BORN_IN]->())
plan:
Produce Results
Project [exists((n)-[:MARRIED]->()-[:BORN_IN]->())]
Apply
Limit [1]
Optional
Expand(All) [@ANON_N1 --> @ANON_N3 ]
Expand(All) [n --> @ANON_N1 ]
Argument [n]
Node Index Seek [n] IN []
cypher:
MATCH (n {name:'Rachel Kempson'}),(m:City) RETURN exists((n)-[:HAS_CHILD]->()-[:BORN_IN]->(m))
plan:
Produce Results
Project [exists((n)-[:HAS_CHILD]->()-[:BORN_IN]->(m))]
Apply
Limit [1]
Optional
Expand(Into) [@ANON_N1 --> m ]
Expand(All) [n --> @ANON_N1 ]
Argument [n,m]
Cartesian Product
Node Index Seek [n] IN []
Node By Label Scan [m:City]
cypher :
MATCH (n:Person)-[:BORN_IN]->(c) WHERE exists((n)-[:HAS_CHILD]->()-[:BORN_IN]->(c)) RETURN n,c;
plan:
Expand(All) [n --> c ]
Node By Label Scan [n:Person]
Produce Results
Project [n,c]
Filter [Exists]
Expand(Into) [@ANON_N2 --> c ]
Expand(All) [n --> @ANON_N2 ]
Argument [n,c]
src/cypher/resultset/record.cpp
Outdated
| } | ||
| } | ||
|
|
||
| bool Entry::GetEntityEfficient(RTContext *ctx) const { |
There was a problem hiding this comment.
Entry::GetEntityEfficient这个方法在做什么?作用?
There was a problem hiding this comment.
这个方法是在判断某个record是点或者边,它是不是有效的,有没有保存一个正常的vid或者euid,作用是在exists表达式中判断表达式的结果
| field_, value, value); | ||
| } else { | ||
| // Weak index iterator | ||
| // Weak index iterator] |
| eit_->FreeIter(); | ||
| neighbor_->PushVid(-1); | ||
| if (!expand_into_) | ||
| neighbor_->PushVid(-1); |
There was a problem hiding this comment.
if (!expand_into_) neighbor_->PushVid(-1);
或者
if (!expand_into_) {
neighbor_->PushVid(-1);
}
src/cypher/resultset/record.cpp
Outdated
| } | ||
| } | ||
|
|
||
| bool Entry::GetEntityEfficient(RTContext *ctx) const { |
There was a problem hiding this comment.
这个命名再斟酌一下:
这个是一个校验某个Entity的是否“有效”,不是获取一个Entity
There was a problem hiding this comment.
已改为CheckEntityEfficient
| std::string s = "Execution Plan Before Connect: \n"; | ||
| if (lgraph_log::LoggerManager::GetInstance().GetLevel() | ||
| == lgraph_log::severity_level::DEBUG) { | ||
| if (lgraph_log::LoggerManager::GetInstance().GetLevel() == lgraph_log::severity_level::DEBUG) { |
There was a problem hiding this comment.
这里不太合适:log level不是debug导致 _DumpPlanBeforeConnect 返回结果不同
No description provided.