[
https://issues.apache.org/jira/browse/CALCITE-5845?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17742706#comment-17742706
]
LakeShen edited comment on CALCITE-5845 at 7/13/23 8:34 AM:
------------------------------------------------------------
I debug the source code,the initial SqlNode which select one thousand 1 = 1
predicate is :
!image-2023-07-13-16-17-37-600.png|width=665,height=243!
when change SqlBasicCall to RexNode,it would recursive call the
StandardConvertletTable#convertOperands method to convert SqlBasicCall's
operandList to RexNode.
In the example above, in the operandList of the outermost SqlBasicCall, its
first is Operator 1 = 1 (999) and second Operator is 1 = 1
Then Calcite will recursively call StandardConvertletTable#convertOperands
method to convert 1 = 1 (999) to RexNode .
Finally, the above exception is thrown
The code is :
1.
[StandardConvertletTable#convertOperands|https://github.com/apache/calcite/blob/55f714cc37ca7d60a6c95196f404a370d6ff0dfd/core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java#L1112C5-L1115C6]
was (Author: shenlang):
I debug the source code,the initial SqlNode which select one thousand 1 = 1 is :
!image-2023-07-13-16-17-37-600.png|width=665,height=243!
when change SqlBasicCall to RexNode,it would recursive call the
StandardConvertletTable#convertOperands method to convert SqlBasicCall's
operandList to RexNode.
In the example above, in the operandList of the outermost SqlBasicCall, its
first is Operator 1 = 1 (999) and second Operator is 1 = 1
Then Calcite will recursively call StandardConvertletTable#convertOperands
method to convert 1 = 1 (999) to RexNode .
Finally, the above exception is thrown
The code is :
1. [StandardConvertletTable#convertOperands|
https://github.com/apache/calcite/blob/55f714cc37ca7d60a6c95196f404a370d6ff0dfd/core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java#L1112C5-L1115C6]
> select a very large predicate throw threw 'java.lang.StackOverflowError'
> exception in SqlNode to RelNode phase
> --------------------------------------------------------------------------------------------------------------
>
> Key: CALCITE-5845
> URL: https://issues.apache.org/jira/browse/CALCITE-5845
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.34.0
> Reporter: LakeShen
> Priority: Major
> Fix For: 1.36.0
>
> Attachments: image-2023-07-13-16-10-19-643.png,
> image-2023-07-13-16-17-37-600.png
>
>
> When I run an SQL and it selects a very large predicate that has one thousand
> 1 = 1 predicate, all of them connected AND, the sql like this :
> {code:java}
> select 1 = 1 and 1 = 1 and 1 = 1 and 1 = 1 ......(one thousand 1 = 1){code}
> At the SqlNode to RelNode phase,Calcite throw StackOverflowError exception:
> !image-2023-07-13-16-10-19-643.png|width=949,height=186!
--
This message was sent by Atlassian Jira
(v8.20.10#820010)