alibaba / GraphScope

🔨 🍇 💻 🚀 GraphScope: A One-Stop Large-Scale Graph Computing System from Alibaba | 一站式图计算系统
https://graphscope.io
Apache License 2.0
3.3k stars 447 forks source link

feat(interactive): Support `In` in cypher query #3658

Open zhanglei1949 opened 8 months ago

zhanglei1949 commented 8 months ago

When I try the following query on GIE Compiler, errors occurs.

MATCH(p : PERSON)-[:KNOWS]->(friend: PERSON)
WITH collect(friend) AS friends
MATCH (messageAuthor: PERSON)<-[:HASCREATOR]-(:POST)-[:HASTAG]->(tag: TAG)
WHERE messageAuthor IN friends
RETURN messageAuthor.id As authorId;

The error is

Exception in thread "main" java.lang.IllegalArgumentException: {alias=IN} not found; expected aliases are: [messageAuthor, tag, friends]
        at com.alibaba.graphscope.common.ir.tools.GraphBuilder.getAliasField(GraphBuilder.java:595)
        at com.alibaba.graphscope.common.ir.tools.GraphBuilder.variable(GraphBuilder.java:448)
        at com.alibaba.graphscope.cypher.antlr4.visitor.ExpressionVisitor.visitOC_Variable(ExpressionVisitor.java:254)
        at com.alibaba.graphscope.cypher.antlr4.visitor.ExpressionVisitor.visitOC_Variable(ExpressionVisitor.java:58)
        at com.alibaba.graphscope.grammar.CypherGSParser$OC_VariableContext.accept(CypherGSParser.java:5747)
        at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
        at com.alibaba.graphscope.grammar.CypherGSBaseVisitor.visitOC_Atom(CypherGSBaseVisitor.java:279)
        at com.alibaba.graphscope.cypher.antlr4.visitor.ExpressionVisitor.visitOC_PropertyOrLabelsExpression(ExpressionVisitor.java:225)
        at com.alibaba.graphscope.cypher.antlr4.visitor.ExpressionVisitor.visitOC_PropertyOrLabelsExpression(ExpressionVisitor.java:58)
        at com.alibaba.graphscope.grammar.CypherGSParser$OC_PropertyOrLabelsExpressionContext.accept(CypherGSParser.java:3232)
        at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
        at com.alibaba.graphscope.grammar.CypherGSBaseVisitor.visitOC_ListOperatorExpression(CypherGSBaseVisitor.java:258)
        at com.alibaba.graphscope.cypher.antlr4.visitor.ExpressionVisitor.visitOC_UnaryAddOrSubtractExpression(ExpressionVisitor.java:215)
        at com.alibaba.graphscope.cypher.antlr4.visitor.ExpressionVisitor.lambda$visitOC_MultiplyDivideModuloExpression$3(ExpressionVisitor.java:208)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
        at com.alibaba.graphscope.cypher.antlr4.visitor.ExpressionVisitor.visitOC_MultiplyDivideModuloExpression(ExpressionVisitor.java:209)
        at com.alibaba.graphscope.cypher.antlr4.visitor.ExpressionVisitor.lambda$visitOC_AddOrSubtractOrBitManipulationExpression$2(ExpressionVisitor.java:193)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
        at com.alibaba.graphscope.cypher.antlr4.visitor.ExpressionVisitor.visitOC_AddOrSubtractOrBitManipulationExpression(ExpressionVisitor.java:194)
        at com.alibaba.graphscope.cypher.antlr4.visitor.ExpressionVisitor.visitOC_StringPredicateExpression(ExpressionVisitor.java:132)
        at com.alibaba.graphscope.cypher.antlr4.visitor.ExpressionVisitor.visitOC_ComparisonExpression(ExpressionVisitor.java:113)
        at com.alibaba.graphscope.cypher.antlr4.visitor.ExpressionVisitor.visitOC_NullPredicateExpression(ExpressionVisitor.java:171)
        at com.alibaba.graphscope.cypher.antlr4.visitor.ExpressionVisitor.visitOC_NotExpression(ExpressionVisitor.java:99)
        at com.alibaba.graphscope.cypher.antlr4.visitor.ExpressionVisitor.lambda$visitOC_AndExpression$1(ExpressionVisitor.java:92)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
        at com.alibaba.graphscope.cypher.antlr4.visitor.ExpressionVisitor.visitOC_AndExpression(ExpressionVisitor.java:93)
        at com.alibaba.graphscope.cypher.antlr4.visitor.ExpressionVisitor.lambda$visitOC_OrExpression$0(ExpressionVisitor.java:80)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
        at com.alibaba.graphscope.cypher.antlr4.visitor.ExpressionVisitor.visitOC_OrExpression(ExpressionVisitor.java:81)
        at com.alibaba.graphscope.cypher.antlr4.visitor.ExpressionVisitor.visitOC_OrExpression(ExpressionVisitor.java:58)
        at com.alibaba.graphscope.grammar.CypherGSParser$OC_OrExpressionContext.accept(CypherGSParser.java:1970)
        at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
        at com.alibaba.graphscope.grammar.CypherGSBaseVisitor.visitOC_Expression(CypherGSBaseVisitor.java:181)
        at com.alibaba.graphscope.cypher.antlr4.visitor.GraphBuilderVisitor.visitOC_Where(GraphBuilderVisitor.java:132)
        at com.alibaba.graphscope.cypher.antlr4.visitor.GraphBuilderVisitor.visitOC_Match(GraphBuilderVisitor.java:79)
        at com.alibaba.graphscope.cypher.antlr4.visitor.GraphBuilderVisitor.visitOC_Match(GraphBuilderVisitor.java:39)
        at com.alibaba.graphscope.grammar.CypherGSParser$OC_MatchContext.accept(CypherGSParser.java:886)
        at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
        at com.alibaba.graphscope.grammar.CypherGSBaseVisitor.visitOC_RegularQuery(CypherGSBaseVisitor.java:76)
        at com.alibaba.graphscope.cypher.antlr4.visitor.LogicalPlanVisitor.visitOC_Query(LogicalPlanVisitor.java:64)
        at com.alibaba.graphscope.cypher.antlr4.visitor.LogicalPlanVisitor.visitOC_Query(LogicalPlanVisitor.java:45)
        at com.alibaba.graphscope.grammar.CypherGSParser$OC_QueryContext.accept(CypherGSParser.java:336)
        at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
        at com.alibaba.graphscope.grammar.CypherGSBaseVisitor.visitOC_Statement(CypherGSBaseVisitor.java:27)
        at com.alibaba.graphscope.cypher.antlr4.visitor.LogicalPlanVisitor.visitOC_Cypher(LogicalPlanVisitor.java:56)
        at com.alibaba.graphscope.cypher.antlr4.visitor.LogicalPlanVisitor.visitOC_Cypher(LogicalPlanVisitor.java:45)
        at com.alibaba.graphscope.grammar.CypherGSParser$OC_CypherContext.accept(CypherGSParser.java:202)
        at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
        at com.alibaba.graphscope.common.ir.tools.GraphPlanner.lambda$main$3(GraphPlanner.java:285)
        at com.alibaba.graphscope.common.ir.tools.GraphPlanner$PlannerInstance.planLogical(GraphPlanner.java:125)
        at com.alibaba.graphscope.common.ir.tools.GraphPlanner$PlannerInstance.plan(GraphPlanner.java:112)
        at com.alibaba.graphscope.common.ir.tools.GraphPlanner.main(GraphPlanner.java:287)
github-actions[bot] commented 7 months ago

/cc @shirly121, this issus/pr has had no activity for for a long time, could you folks help to review the status ? To suppress further notifications,