[
https://issues.apache.org/jira/browse/CALCITE-2722?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16770250#comment-16770250
]
Hongze Zhang commented on CALCITE-2722:
---------------------------------------
[~julianhyde], If I'm not missing anything, the previous code is left-deep too.
Because The [use of
"Util.skipLast(...)"|https://github.com/apache/calcite/blob/3cefa45ac13b9768e1a7b7e90ede77c6b6eec27b/core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java#L750]
will make the loop end up with the first two operands.
But currently there is no unit test to guarantee this. Maybe we should somehow
add one in case of the behavior being changed to right-deep?
> SqlImplementor createLeftCall method throws StackOverflowError
> --------------------------------------------------------------
>
> Key: CALCITE-2722
> URL: https://issues.apache.org/jira/browse/CALCITE-2722
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Mykola Zerniuk
> Assignee: Julian Hyde
> Priority: Major
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> SqlImplementor _createLeftCall_ method is implemented using recursion. In
> this case if sql has a lot of AND or OR operators it throws
> StackOverflowError.
> {code:java}
> Caused by: java.lang.StackOverflowError
> at org.apache.calcite.util.Util.skipLast(Util.java:1940)
> at org.apache.calcite.util.Util.skipLast(Util.java:1935)
> at
> org.apache.calcite.rel.rel2sql.SqlImplementor$Context.createLeftCall(SqlImplementor.java:763)
> at
> org.apache.calcite.rel.rel2sql.SqlImplementor$Context.createLeftCall(SqlImplementor.java:765)
> at
> org.apache.calcite.rel.rel2sql.SqlImplementor$Context.createLeftCall(SqlImplementor.java:765){code}
> Since calcite converts IN list to OR this bug is also reproduces on huge IN
> list.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)