[ 
https://issues.apache.org/jira/browse/CALCITE-3488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16992239#comment-16992239
 ] 

Jin Xing edited comment on CALCITE-3488 at 12/10/19 6:52 AM:
-------------------------------------------------------------

[~zolyfarkas] 
 The main functionality for decorrelation is in RelDecorrelator.java and you 
can find tests in SqlToRelConverterTest.java and RelOptRulesTest.java.

There's a classic doc [1], which you can refer to.

[1][https://pdfs.semanticscholar.org/650f/dd065b407e0a4fdd854b1861e58eed289955.pdf]

Best,

Jin


was (Author: jinxing6...@126.com):
[~zolyfarkas] 
The main functionality for decorrelation is in RelDecorrelator.java and you can 
find tests in SqlToRelConverterTest.java and RelOptRulesTest.java.

There's a classic 
doc[https://pdfs.semanticscholar.org/650f/dd065b407e0a4fdd854b1861e58eed289955.pdf],
 which you can refer to.

> Interpreter does not implement LogicalCorelate.
> -----------------------------------------------
>
>                 Key: CALCITE-3488
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3488
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Zoltan Farkas
>            Priority: Major
>
> Example query:
> {code}
> select name,
>          ARRAY(select c2.name from friendships f, characters c2
>                             where f.characterId1 = c.characterId and 
> f.characterId2 = c2.characterId) as friends
> {code}
> where the 2 tables involved are:
> {code}
>     record Character {
>       string characterId;
>       string name = "";
>       string homeWorldPlanet;
>       string speciesName;
>     }
>     record Friendship {
>       string characterId1;
>       string characterId2;
>     }
> {code}
> the plan:
> {code}
> LogicalProject(name=[$1], friends=[$4])
>   LogicalCorrelate(correlation=[$cor0], joinType=[inner], 
> requiredColumns=[{0}])
>     LogicalTableScan(table=[[characters]])
>     Collect(field=[EXPR$0])
>       LogicalProject(name=[$2])
>         LogicalJoin(condition=[=($0, $1)], joinType=[inner])
>           LogicalProject(characterId2=[$1])
>             LogicalFilter(condition=[=($0, $cor0.characterId)])
>               LogicalTableScan(table=[[friendships]])
>           LogicalProject(characterId=[$0], name=[$1])
>             LogicalTableScan(table=[[characters]])\n
> {code}
> when interpreted, results in:
> {code}
> java.lang.UnsupportedOperationException
>       at 
> o.a.c.i.JaninoRexCompiler.lambda$compile$0(JaninoRexCompiler.java:94)[calcite-core-1.21.0.jar:1.21.0]
>       at 
> o.a.c.a.e.RexToLixTranslator.translate0(RexToLixTranslator.java:714)[^]
>       at ^.translate(^:199)[^]
>       at ^.translate0(^:684)[^]
>       at ^.translate(^:199)[^]
>       at ^.translate(^:194)[^]
>       at ^.translateList(^:928)[^]
>       at ^.translateList(^:901)[^]
>       at o.a.c.a.e.RexImpTable.implementCall(RexImpTable.java:1163)[^]
>       at ^.implementNullSemantics(^:1153)[^]
>       at ^.implementNullSemantics0(^:1043)[^]
>       at ^.lambda$createImplementor$4(^:690)[^]
>       at 
> o.a.c.a.e.RexToLixTranslator.translateCall(RexToLixTranslator.java:758)[^]
>       at ^.translate0(^:730)[^]
>       at ^.translate(^:199)[^]
>       at ^.translate0(^:684)[^]
>       at ^.translate(^:199)[^]
>       at ^.translate(^:194)[^]
>       at ^.translateList(^:928)[^]
>       at ^.translateProjects(^:169)[^]
>       at o.a.c.i.JaninoRexCompiler.compile(JaninoRexCompiler.java:101)[^]
>       at o.a.c.i.Interpreter$CompilerImpl.compile(Interpreter.java:487)[^]
>       at o.a.c.i.Nodes$CoreCompiler.compile(Nodes.java:43)[^]
>       at o.a.c.i.TableScanNode.createEnumerable(TableScanNode.java:266)[^]
>       at ^.createProjectableFilterable(^:233)[^]
>       at ^.create(^:81)[^]
>       at o.a.c.i.Nodes$CoreCompiler.visit(Nodes.java:70)[^]
>       at j.i.r.NativeMethodAccessorImpl.invoke0(Native Method)
>       at ^.invoke(^:62)[^]
>       at 
> j.i.r.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[^]
>       at j.l.r.Method.invoke(Method.java:566)[^]
>       at 
> o.a.c.u.ReflectUtil.invokeVisitorInternal(ReflectUtil.java:257)[calcite-core-1.21.0.jar:1.21.0]
>       at ^.invokeVisitor(^:214)[^]
>       at o.a.c.u.ReflectUtil$1.invokeVisitor(^:464)[^]
>       at o.a.c.i.Interpreter$CompilerImpl.visit(Interpreter.java:451)[^]
>       at o.a.c.i.Nodes$CoreCompiler.visit(Nodes.java:43)[^]
>       at o.a.c.r.BiRel.childrenAccept(BiRel.java:45)[^]
>       at o.a.c.i.Interpreter$CompilerImpl.visit(Interpreter.java:447)[^]
>       at o.a.c.i.Nodes$CoreCompiler.visit(Nodes.java:43)[^]
>       at o.a.c.r.SingleRel.childrenAccept(SingleRel.java:72)[^]
>       at o.a.c.i.Interpreter$CompilerImpl.visit(Interpreter.java:447)[^]
>       at o.a.c.i.Nodes$CoreCompiler.visit(Nodes.java:43)[^]
>       at o.a.c.r.SingleRel.childrenAccept(SingleRel.java:72)[^]
>       at o.a.c.i.Interpreter$CompilerImpl.visit(Interpreter.java:447)[^]
>       at o.a.c.i.Nodes$CoreCompiler.visit(Nodes.java:43)[^]
>       at o.a.c.r.BiRel.childrenAccept(BiRel.java:46)[^]
>       at o.a.c.i.Interpreter$CompilerImpl.visit(Interpreter.java:447)[^]
>       at o.a.c.i.Nodes$CoreCompiler.visit(Nodes.java:43)[^]
>       at o.a.c.r.SingleRel.childrenAccept(SingleRel.java:72)[^]
>       at o.a.c.i.Interpreter$CompilerImpl.visit(Interpreter.java:447)[^]
>       at o.a.c.i.Nodes$CoreCompiler.visit(Nodes.java:43)[^]
>       at o.a.c.i.Interpreter$CompilerImpl.visitRoot(Interpreter.java:405)[^]
>       at o.a.c.i.Interpreter.<init>(^:88)[^]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to