GraphScope
GraphScope copied to clipboard
[BUG] `BothV()` not supported in Gremlin in Calcite-based Compiler
Describe the bug A clear and concise description of what the bug is.
As titled.
Below is an example query on lsqb dataset that illustrates the problem:
gremlin> g.V().hasLabel("city").has("id", 111).bothE("isLocatedIn").bothV()
==>e[48167737][72088380363509640-isLocatedIn->648518346341351535]
==>e[48167890][72092778410023144-isLocatedIn->648518346341351535]
==>e[48169242][72066390130974264-isLocatedIn->648518346341351535]
==>e[48170302][72057594037953336-isLocatedIn->648518346341351535]
==>e[48170858][72092778410022784-isLocatedIn->648518346341351535]
==>e[48171593][72092778410034236-isLocatedIn->648518346341351535]
...
, where bothV() is ignored.
The logical plan looks like:
GraphLogicalProject($f0=[_], isAppend=[false])
GraphLogicalExpand(tableConfig=[{isAll=false, tables=[isLocatedIn]}], alias=[_], opt=[BOTH])
GraphLogicalSource(tableConfig=[{isAll=false, tables=[city]}], alias=[_], fusedFilter=[[=(_.id, 111)]], opt=[VERTEX])
and the physical plan looks like:
operations: [
PhysicalOpr {
opr: Scan(
Scan {
scan_opt: Vertex,
...
}
PhysicalOpr {
opr: Repartition(
Repartition {
strategy: Some(
ToAnother(
Shuffle {
shuffle_key: None,
},
),
),
},
),
},
PhysicalOpr {
opr: Edge(
EdgeExpand {
v_tag: None,
direction: Both,
params: Some(
QueryParams {
tables: [
NameOrId {
item: Some(
Id(
11,
),
),
},
],
columns: [],
is_all_columns: false,
limit: None,
predicate: None,
sample_ratio: 1.0,
extra: {},
},
),
alias: None,
expand_opt: Edge,
is_optional: false,
},
),
},
PhysicalOpr {
opr: Project(
Project {
...})}
which miss the GetV operator for bothV().
To reproduce, compiler configuration is as follows:
graph.planner.is.on=true
graph.planner.opt=RBO
graph.planner.rules=FilterIntoJoinRule, FilterMatchRule, ExtendIntersectRule, ExpandGetVFusionRule
graph.physical.opt=proto
gremlin.script.language.name=antlr_gremlin_calcite