[ 
https://issues.apache.org/jira/browse/CALCITE-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Hyde updated CALCITE-3877:
---------------------------------
    Description: 
Null lowerBound/upperBond in RexWindow causes NPE in RexShuttle. Here's a test 
that can be dropped into RexShuttleTest.java: 
{code: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));
}
{code}
That will raise an NPE. Fix is to handle NULLs when doing the child accept on 
the RexWindowBound[s] in RexShuttle.visitWindow.

  was:
Here's a test that can be dropped into RexShuttleTest.java

 
{code: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));
}
{code}
 

 

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


> In RexWindow, make fields upperBound and lowerBound not-nullable
> ----------------------------------------------------------------
>
>                 Key: CALCITE-3877
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3877
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Steven Talbot
>            Assignee: Julian Hyde
>            Priority: Major
>             Fix For: 1.23.0
>
>
> Null lowerBound/upperBond in RexWindow causes NPE in RexShuttle. Here's a 
> test that can be dropped into RexShuttleTest.java: 
> {code: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));
> }
> {code}
> That will raise an NPE. Fix is to handle NULLs when doing the child accept on 
> the RexWindowBound[s] in RexShuttle.visitWindow.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to