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

ZheHu commented on CALCITE-5745:
--------------------------------

Per 
[Oracle-19-release|https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/About-SQL-Functions.html#GUID-D51AB228-518C-4213-8BD4-F919623D105E],
 the Oracle Database currently treats a character value with a length of zero 
as null(I think this is the compatible mode you mentioned above). However, they 
also mention that "Any arithmetic expression containing a null always evaluates 
to null. For example, null added to 10 is null. In fact, all operators 
({*}except concatenation{*}) return null when given a null operand."
And the concatenation operator is equivalent to CONCAT function in Oracle.

> CONCAT2 function(enabled in Oracle library) gets wrong result when one of the 
> argument is NULL
> ----------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-5745
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5745
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.34.0
>            Reporter: ZheHu
>            Assignee: ZheHu
>            Priority: Major
>
> Tested CONCAT function in Oracle and got the corresponding results.
> {code}
> select concat('a', cast(null as varchar(20))) from DUAL;
> --- results in 'a'
> {code}
> {code}
> select concat('a', null) from DUAL;
> select 'a' ||  null from DUAL;
> --- both result in 'a'
> {code}
> In Calcite(see checkConcat2Func() in SqlOperatorTest.java), CONCAT2 function 
> gets null when running:
> {code}
> concat('a', cast(null as varchar))
> {code}



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

Reply via email to