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

Exception when query from UDF field with structured type

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.23.0, 1.24.0
    • Fix Version/s: 1.25.0
    • Component/s: core

      Description

      Check this sql in SqlToRelConverterTest

      @Test void testUdfWithStructuredReturnType() {
          final String sql = "SELECT deptno, tmp.r.not_null_field, tmp.r.nullable_field FROM\n"
              + "(SELECT deptno, ROW_FUNC() AS r from dept)tmp";
          sql(sql).ok();
        }
      

      ArrayIndexOutOfBoundsException throws because the nested field got a -1 index when querying the field by simple name.

      To solve the problem, for a nested field, return its parent field's monotonicity.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                danny0405 Danny Chen
                Reporter:
                danny0405 Danny Chen
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m