[
https://issues.apache.org/jira/browse/CALCITE-5176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17545681#comment-17545681
]
Julian Hyde commented on CALCITE-5176:
--------------------------------------
Where did you add this test? Looks like {{SqlToRelConverterTest}}.
{quote}
Is there a way to limit on how deeply nested a plan can be?
{quote}
Not currently. Feel free to propose a solution.
> Deeply nested relational expressions leads to StackOverflowError
> ----------------------------------------------------------------
>
> Key: CALCITE-5176
> URL: https://issues.apache.org/jira/browse/CALCITE-5176
> Project: Calcite
> Issue Type: Bug
> Reporter: Yingyu Wang
> Priority: Major
>
> The problem can be reproduced using following test using many levels of UNION:
> {code:java}
> @Test void testLargeUnion() {
> String unionClauses = LongStream.range(0, 1000L)
> .map(i -> i + Integer.MAX_VALUE)
> .mapToObj(Long::toString)
> .collect(Collectors.joining("\nUNION SELECT "));
> final String sql = "SELECT 1 AS prescription_id\n" +
> "UNION SELECT " + unionClauses;
> sql(sql).ok();
> } {code}
> Error:
> {noformat}
> java.lang.StackOverflowError
> at org.apache.calcite.rel.RelShuttleImpl.visit(RelShuttleImpl.java:141)
> at
> org.apache.calcite.sql2rel.RelDecorrelator$CorelMapBuilder.visit(RelDecorrelator.java:2943)
> at
> org.apache.calcite.rel.RelHomogeneousShuttle.visit(RelHomogeneousShuttle.java:76)
> at
> org.apache.calcite.rel.logical.LogicalUnion.accept(LogicalUnion.java:92)
> at
> org.apache.calcite.rel.RelShuttleImpl.visitChild(RelShuttleImpl.java:57)
> at
> org.apache.calcite.sql2rel.RelDecorrelator$CorelMapBuilder.visitChild(RelDecorrelator.java:2948)
> at
> org.apache.calcite.rel.RelShuttleImpl.visitChildren(RelShuttleImpl.java:71)
> at org.apache.calcite.rel.RelShuttleImpl.visit(RelShuttleImpl.java:141)
> at
> org.apache.calcite.sql2rel.RelDecorrelator$CorelMapBuilder.visit(RelDecorrelator.java:2943)
> at
> org.apache.calcite.rel.RelHomogeneousShuttle.visit(RelHomogeneousShuttle.java:76)
> at
> org.apache.calcite.rel.logical.LogicalUnion.accept(LogicalUnion.java:92)
> at
> org.apache.calcite.rel.RelShuttleImpl.visitChild(RelShuttleImpl.java:57)
> at
> org.apache.calcite.sql2rel.RelDecorrelator$CorelMapBuilder.visitChild(RelDecorrelator.java:2948)
> at
> org.apache.calcite.rel.RelShuttleImpl.visitChildren(RelShuttleImpl.java:71)
> at org.apache.calcite.rel.RelShuttleImpl.visit(RelShuttleImpl.java:141)
> at
> org.apache.calcite.sql2rel.RelDecorrelator$CorelMapBuilder.visit(RelDecorrelator.java:2943)
> at
> org.apache.calcite.rel.RelHomogeneousShuttle.visit(RelHomogeneousShuttle.java:76)
> at
> org.apache.calcite.rel.logical.LogicalUnion.accept(LogicalUnion.java:92)
> ...{noformat}
> Is there a way to limit on how deeply nested a plan can be?
--
This message was sent by Atlassian Jira
(v8.20.7#820007)