[ https://issues.apache.org/jira/browse/CALCITE-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17308584#comment-17308584 ]
Stamatis Zampetakis commented on CALCITE-3877: ---------------------------------------------- [~julianhyde], I totally understand that unbounded ROWS and RANGE are functionally equivalent. My previous comment focuses on the translation from Calcite to Physical-X. Let's assume that the translator never had logic to support window types with RANGE although they do have the necessary pieces in place to treat ROWS. Before upgrading to calcite 1.23.0 their Calcite plan never had RANGE in it so there was no problem. After the upgrade unbounded ROWS is turned into RANGE so the translator fails to process the new information. In order to make the translator work again we would need to detect the case of unbounded RANGE and map it differently and this is what I find a bit unnecessary. To create an analogy it is possible to have a COALESCE operator in the plan even if it is possible to express the same using CASE. Certainly we have mechanisms to transform the former in the latter but we don't have assertions in RexCall that forbid the use of COALESCE; it would be very restrictive. > 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)