Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-1051

Underflow exception occurs when executing query which has an in-clause with more than 19 ids

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.6.0
    • Component/s: None
    • Labels:
      None

      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:

      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)
      

      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.

        Attachments

          Activity

            People

            • Assignee:
              julianhyde Julian Hyde
              Reporter:
              frankieb Frankie Bollaert
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: