Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve GroupStepFilter #329

Closed
mad opened this issue Nov 5, 2019 · 1 comment · Fixed by #331
Closed

Improve GroupStepFilter #329

mad opened this issue Nov 5, 2019 · 1 comment · Fixed by #331

Comments

@mad
Copy link
Contributor

mad commented Nov 5, 2019

Currently this query can not evaluated effectively

 MATCH (p:Person) WHERE id(p) in {ids} RETURN p.name

Where {ids} is a collection of ids

Seems to small addition of GroupStepFilter might improve this case

Index: translation/src/main/scala/org/opencypher/gremlin/translation/ir/rewrite/GroupStepFilters.scala
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- translation/src/main/scala/org/opencypher/gremlin/translation/ir/rewrite/GroupStepFilters.scala	(revision 13a6ea11c13e448524afd03db288fefce875eb3d)
+++ translation/src/main/scala/org/opencypher/gremlin/translation/ir/rewrite/GroupStepFilters.scala	(date 1572989235672)
@@ -99,6 +99,9 @@
       case ChooseT3(Seq(Constant(value)), _, _) :: Is(_) :: As(_) :: SelectK(stepLabel) :: ChooseP2(_, Seq(Id)) :: Is(_) :: WhereP(
             _: Eq) :: Nil =>
         (stepLabel, HasP(T.id.getAccessor, Eq(value))) :: Nil
+      case ChooseT3(Seq(Constant(value)), _, _) :: Is(_) :: As(_) :: SelectK(stepLabel) :: ChooseP2(_, Seq(Id)) :: Is(_) :: WhereP(
+            _: Within) :: Nil =>
+        (stepLabel, HasP(T.id.getAccessor, Within(value))) :: Nil
       case SelectK(stepLabel) :: rest if rest.forall(_.isInstanceOf[HasLabel]) =>
         rest.map((stepLabel, _))
       case _ =>
@@ -115,6 +118,9 @@
         None
       case ChooseT3(Seq(Constant(_)), _, _) :: Is(_) :: As(_) :: SelectK(alias) :: ChooseP2(_, Seq(Id)) :: Is(_) :: WhereP(
             _: Eq) :: Nil if aliases.contains(alias) =>
+        None
+      case ChooseT3(Seq(Constant(_)), _, _) :: Is(_) :: As(_) :: SelectK(alias) :: ChooseP2(_, Seq(Id)) :: Is(_) :: WhereP(
+            _: Within) :: Nil if aliases.contains(alias) =>
         None
       case SelectK(alias) :: rest if aliases.contains(alias) && rest.forall(_.isInstanceOf[HasLabel]) =>
         None
dwitry added a commit to dwitry/cypher-for-gremlin that referenced this issue Nov 6, 2019
- resolves opencypher#329

Signed-off-by: Dwitry dwitry@users.noreply.github.com
@dwitry
Copy link
Contributor

dwitry commented Nov 6, 2019

Hello @mad,

thank you for contribution. Good improvement, I will merge this in #331.

dwitry added a commit that referenced this issue Nov 6, 2019
- resolves #329

Signed-off-by: Dwitry dwitry@users.noreply.github.com
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 a pull request may close this issue.

2 participants