[
https://issues.apache.org/jira/browse/CALCITE-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17307740#comment-17307740
]
Stamatis Zampetakis commented on CALCITE-3877:
----------------------------------------------
Hi [~julianhyde],
I just noticed that after this change we strongly enforce people to use RANGE
instead of ROWS for unbounded windows.
{noformat}
"RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING" (that is, not
bracket) is equivalent to "ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED
FOLLOWING", but we require RANGE, to keep things canonical.
{noformat}
It's nice to keep things canonical when possible but different engines may
support only one or the other (ROWS vs RANGE) and not both. Moreover, it may be
that they also have different physical implementations for each frame type with
different performance implications.
If users want to keep ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
in the Calcite plan they have to copy-paste entire classes (e.g., RexWindow,
etc.) to achieve that which is not very good for the project.
Could we reconsider this decision and allow both unbounded ROWS and RANGE in
the plan?
> 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)