[
https://issues.apache.org/jira/browse/CALCITE-7834?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18123206#comment-18123206
]
Julian Hyde edited comment on CALCITE-7834 at 10/5/26 1:39 AM:
---------------------------------------------------------------
The summary is a bit ambiguous and could be misinterpreted. It can be read as a
prescription ({_}'LAG/LEAD shouldn't always be nullable'{_}) rather than a
description of the bug ({_}'The inferred type is currently incorrectly marked
as non-nullable'{_}).
To make it clearer to the reader, could you change it to something like
'{_}Type inferred for LAG/LEAD should always be nullable{_}'?
was (Author: julianhyde):
The summary is a bit ambiguous and could be misinterpreted. It can be read as a
prescription ({_}'LAG/LEAD shouldn't always be nullable'{_}) rather than a
description of the bug ({_}'The inferred type is currently incorrectly marked
as non-nullable'{_}).
To make it clearer to the reader, could you change it to something like 'Type
inferred for LAG/LEAD should always be nullable'?"
> Type inferred for LAG/LEAD is not always nullable
> -------------------------------------------------
>
> Key: CALCITE-7834
> URL: https://issues.apache.org/jira/browse/CALCITE-7834
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.42.0
> Reporter: Mihai Budiu
> Assignee: Mihai Budiu
> Priority: Minor
> Labels: pull-request-available
>
> The column produced by LAG/LEAD should always be nullable, but Calcite copies
> the input column type. As a result, the following quidem test crashes:
> {code:java}
> SELECT y, x, LAG(x, 1, 0) OVER (ORDER BY y) AS l
> FROM (VALUES (1, 10), (2, CAST(NULL AS INTEGER)), (3, 30)) AS t(y, x); {code}
> stack trace:
> {code:java}
> Caused by: org.apache.calcite.runtime.CalciteException: Cannot convert null
> to int
> at
> java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67)
> at
> java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
> at
> java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:484)
> at
> org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:511)
> at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:605)
> at
> org.apache.calcite.runtime.SqlFunctions.cannotConvert(SqlFunctions.java:5283)
> at org.apache.calcite.runtime.SqlFunctions.toInt(SqlFunctions.java:5464)
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)