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

In RexWindow, make fields upperBound and lowerBound not-nullable

    XMLWordPrintableJSON

    Details

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

      Description

      Null lowerBound/upperBond in RexWindow causes NPE in RexShuttle. Here's a test that can be dropped into RexShuttleTest.java: 

      @Test public void handlesNullBoundsInRexWindow() {
        final RelBuilder builder = RelBuilder.create(RelBuilderTest.config().build());
        final RexNode over = builder.getRexBuilder().makeOver(
            builder.getTypeFactory().createSqlType(SqlTypeName.BIGINT),
            SqlStdOperatorTable.ROW_NUMBER,
            ImmutableList.of(),
            ImmutableList.of(),
            ImmutableList.of(),
            null,
            null,
            true,
            true,
            true,
            true,
             true
        );
        assertThat(over.accept(new RexShuttle()), is(over));
      }
      

      That will raise an NPE. Fix is to handle NULLs when doing the child accept on the RexWindowBound[s] in RexShuttle.visitWindow.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                julianhyde Julian Hyde
                Reporter:
                swtalbot Steven Talbot
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: