diff --git a/src/graph/optimizer/rule/PushEFilterDownRule.cpp b/src/graph/optimizer/rule/PushEFilterDownRule.cpp index 3b5df8904d2..b49ccfb5d1d 100644 --- a/src/graph/optimizer/rule/PushEFilterDownRule.cpp +++ b/src/graph/optimizer/rule/PushEFilterDownRule.cpp @@ -144,7 +144,7 @@ std::string PushEFilterDownRule::toString() const { const storage::cpp2::EdgeProp &edge, meta::SchemaManager *schemaMng, ObjectPool *pool) { - auto edgeNameResult = schemaMng->toEdgeName(spaceId, edge.get_type()); + auto edgeNameResult = schemaMng->toEdgeName(spaceId, std::abs(edge.get_type())); if (!edgeNameResult.ok()) { return nullptr; } diff --git a/tests/tck/features/optimizer/PushEFilterDownRule.feature b/tests/tck/features/optimizer/PushEFilterDownRule.feature index 96637782021..747e95fa6b8 100644 --- a/tests/tck/features/optimizer/PushEFilterDownRule.feature +++ b/tests/tck/features/optimizer/PushEFilterDownRule.feature @@ -25,6 +25,34 @@ Feature: Push EFilter down rule | 8 | Traverse | 7 | {"edge filter": "", "filter": "(like.likeness==95)"} | | 7 | IndexScan | 0 | | | 0 | Start | | | + When profiling query: + """ + MATCH (v:player{name: 'Tim Duncan'})<-[e:like{likeness: 95}]-() return v.player.name AS name + """ + Then the result should be, in any order: + | name | + | "Tim Duncan" | + | "Tim Duncan" | + And the execution plan should be: + | id | name | dependencies | operator info | + | 5 | Project | 8 | | + | 8 | Traverse | 7 | {"edge filter": "", "filter": "(like.likeness==95)"} | + | 7 | IndexScan | 0 | | + | 0 | Start | | | + When profiling query: + """ + MATCH (v:player{name: 'Tim Duncan'})-[e:like{likeness: 95}]-() return v.player.name AS name + """ + Then the result should be, in any order: + | name | + | "Tim Duncan" | + | "Tim Duncan" | + And the execution plan should be: + | id | name | dependencies | operator info | + | 5 | Project | 8 | | + | 8 | Traverse | 7 | {"edge filter": "", "filter": "(like.likeness==95)"} | + | 7 | IndexScan | 0 | | + | 0 | Start | | | When profiling query: """ MATCH (v:player{name: 'Tim Duncan'})-[e:like*1..2{likeness: 95}]->() return v.player.name AS name