You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Feng Zhu (Jira)" <ji...@apache.org> on 2020/01/07 02:37:00 UTC
[jira] [Comment Edited] (CALCITE-3627) Incorrect null semantic for
ROW function
[ https://issues.apache.org/jira/browse/CALCITE-3627?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17009312#comment-17009312 ]
Feng Zhu edited comment on CALCITE-3627 at 1/7/20 2:36 AM:
-----------------------------------------------------------
Hi, [~zabetak], current behavior:
{code:java}
Q1: SELECT ROW(cast(null as int), 1)
returns: {null, 1}
Q2: SELECT ROW(1, cast(null as int))
returns: {1, null}
Q3: SELECT ROW(cast(null as int), cast(null as int))
returns: {null, null}
{code}
The point of this Jira is Q3's result. Whether \{null, null} should be treated as null.
If \{null, null} is not null, ROW function's NullPolicy should be NONE.
If \{null, null} is null, we need to create a new one for this case.
was (Author: donnyzone):
Hi, [~zabetak], current behavior:
{code:java}
Q1: SELECT ROW(cast(null as int), 1)
returns: {null, 1}
Q2: SELECT ROW(1, cast(null as int))
returns: {1, null}
Q3: SELECT ROW(cast(null as int), cast(null as int))
returns: {null, null}
{code}
The point of this Jira is Q3's result. Whether \{null, null} should be treat as null.
If \{null, null} is not null, ROW function's NullPolicy should be NONE.
If \{null, null} is null, we need to create a new one for this case.
> Incorrect null semantic for ROW function
> ----------------------------------------
>
> Key: CALCITE-3627
> URL: https://issues.apache.org/jira/browse/CALCITE-3627
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Feng Zhu
> Assignee: Feng Zhu
> Priority: Major
> Labels: pull-request-available
> Time Spent: 50m
> Remaining Estimate: 0h
>
> In CALCITE-2464, an in-depth discussion on nullability of structured type has been conducted.
> According to SQL standards, a record's value (with structure type) is considered null if and only if all of its fields are null.
> Based on that, the *ROW* function's return type can be nullable.
> Moreover, current implementor for ROW function's _*NullPolicy*_ (_NullPolicy.ANY_) contradicts its runtime behavior.
> {code:java}
> Query:
> select ROW(1, cast(null as int))
> Result:
> {1, null}{code}
> However, according to the NullPolicy, the result should be null.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)