You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Evgeny Stanilovsky (Jira)" <ji...@apache.org> on 2023/05/19 05:23:00 UTC

[jira] [Comment Edited] (CALCITE-5708) Change SUBSTRING result if either of parameters is NULL

    [ https://issues.apache.org/jira/browse/CALCITE-5708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17724120#comment-17724120 ] 

Evgeny Stanilovsky edited comment on CALCITE-5708 at 5/19/23 5:22 AM:
----------------------------------------------------------------------

yep, i check your expressions and it`s really ok, but if you try one from :

{noformat}
select SUBSTRING(NULL FROM 1 FOR 2);
select SUBSTRING('text' FROM 1 FOR NULL);
select SUBSTRING('text' FROM NULL FOR 2);
{noformat}
It will be failed with :

{noformat}
Cannot apply 'SUBSTRING' to arguments of type 'SUBSTRING(<CHAR(4)> FROM <NULL> FOR <INTEGER>)'.
{noformat}




was (Author: zstan):
ye, i check your expressions and it`s really ok, but if you try one from :

{noformat}
select SUBSTRING(NULL FROM 1 FOR 2);
select SUBSTRING('text' FROM 1 FOR NULL);
select SUBSTRING('text' FROM NULL FOR 2);
{noformat}
It will be failed with :

{noformat}
Cannot apply 'SUBSTRING' to arguments of type 'SUBSTRING(<CHAR(4)> FROM <NULL> FOR <INTEGER>)'.
{noformat}



> Change SUBSTRING result if either of parameters is NULL
> -------------------------------------------------------
>
>                 Key: CALCITE-5708
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5708
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.34.0
>            Reporter: Evgeny Stanilovsky
>            Assignee: Evgeny Stanilovsky
>            Priority: Major
>              Labels: patch-available
>
> According to standard:
> {noformat}
> 6.18 <string value function>
> ...
> 3)If <character substring function> is specified, then:
> ...
> c) If either C, S, or L is the null value, then the result of the <character substring function> is
> the null value.
> {noformat}
> calcite not follow this rule for now.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)