[ https://issues.apache.org/jira/browse/CALCITE-1051?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Frankie Bollaert updated CALCITE-1051: -------------------------------------- Description: Underflow exception occurs when executing query with more then 19 values in the in-clause. Example below illustrates the problem in the csv example: {code} select e.name from emps as e where e.empno in (130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130 ); Error: Error while executing SQL "select e.name from emps as e where e.empno in (130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130 )": Underflow (state=,code=0) {code} The SqlToRelConverter will convert this to a SemiJoin. Literals in the IN clause value list are scaled. When the type of the literal does not have a scale set, as happens with a java.lang.Integer, the default value of the type.scale is chosen, which is Integer.MIN_VALUE. Scaling to this value causes the underflow. You can find a patch attached to show where the code could potentially be fixed. was: Underflow exception occurs when executing query with more then 19 values in the in-clause. Example below illustrates the problem in the csv example: {code} select e.name from emps as e where e.empno in (130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130 ); Error: Error while executing SQL "select e.name from emps as e where e.empno in (130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130 )": Underflow (state=,code=0) {code} The SqlToRelConverter will convert this to a SemiJoin. Literals in the IN clause value list are scaled. When the type of the literal does not have a scale set, as happens with a java.lang.Integer, the default value of the type.scale is chosen, which is Integer.MIN_VALUE. Scaling to this value causes the underflow. > Underflow exception occurs when executing query which has an in-clause with > more than 19 ids > -------------------------------------------------------------------------------------------- > > Key: CALCITE-1051 > URL: https://issues.apache.org/jira/browse/CALCITE-1051 > Project: Calcite > Issue Type: Bug > Reporter: Frankie Bollaert > Assignee: Julian Hyde > Priority: Minor > Attachments: > 0001-fix-underflow-due-to-scaling-in-clause-literals.patch > > > Underflow exception occurs when executing query with more then 19 values in > the in-clause. > Example below illustrates the problem in the csv example: > {code} > select e.name from emps as e where e.empno in (130, 130, 130, 130, 130, 130, > 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130 ); > Error: Error while executing SQL "select e.name from emps as e where e.empno > in (130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, > 130, 130, 130, 130, 130, 130 )": Underflow (state=,code=0) > {code} > The SqlToRelConverter will convert this to a SemiJoin. Literals in the IN > clause value list are scaled. When the type of the literal does not have a > scale set, as happens with a java.lang.Integer, the default value of the > type.scale is chosen, which is Integer.MIN_VALUE. Scaling to this value > causes the underflow. > You can find a patch attached to show where the code could potentially be > fixed. -- This message was sent by Atlassian JIRA (v6.3.4#6332)