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

Validator throws IndexOutOfBoundsException when trying to infer operand type from struct return type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.17.0
    • 1.18.0
    • core
    • None

    Description

      IOOBE was thrown when trying to acquire SqlOperandTypeInference using RETURN_TYPE at:
      https://github.com/apache/calcite/blob/branch-1.17/core/src/main/java/org/apache/calcite/sql/type/InferTypes.java#L68

      The follow SQLs demonstrates how to trigger the exception over a simple Schema:

      - table1:
        - structType1:
          - intField
        - structType2:
          - intField
          - bigintField
      
      • Exception SQL:
        SELECT structType1 AS myStructType FROM table1
        
      • Correct SQL:
        SELECT structType1 FROM table1
        
        SELECT structType2 AS myStructType FROM table1
        

      E2E example can be found in:
      https://github.com/apache/calcite/commit/d5fb1f9fc5d3f9583128d9ee35c4a23e8470d54d

      Attachments

        Issue Links

          Activity

            People

              julianhyde Julian Hyde
              rongr Rong Rong
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: