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

[jira] [Commented] (CALCITE-1924) Support operator "+" as string concat operator(enabled in MSSQL library)

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

ZheHu commented on CALCITE-1924:
--------------------------------

According to [mssql-concat-doc|https://learn.microsoft.com/en-us/sql/t-sql/functions/concat-transact-sql?view=sql-server-ver16], CONCAT implicitly converts null values to empty strings. If CONCAT receives arguments with all NULL values, it will return an empty string of type varchar(1).
It behaves differently in Calcite, maybe we should support MSSQL_CONCAT first, then consider overloading "+" operator in MSSQL library.

> Support operator "+" as string concat operator(enabled in MSSQL library)
> ------------------------------------------------------------------------
>
>                 Key: CALCITE-1924
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1924
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Roger Shi
>            Assignee: ZheHu
>            Priority: Minor
>
> Currently the following SQL is not supported.
> {code}
> select 'A' + 'B' + 'C';
> {code}
> We get the exception:
> {noformat}
> Error while executing SQL "select 'A' + 'B' + 'C'": From line 1, column 8 to line 1, column 16: Cannot apply '+' to arguments of type '<CHAR(1)> + <CHAR(1)>'. Supported form(s): '<NUMERIC> + <NUMERIC>'
> '<DATETIME_INTERVAL> + <DATETIME_INTERVAL>'
> '<DATETIME> + <DATETIME_INTERVAL>'
> '<DATETIME_INTERVAL> + <DATETIME>' (state=,code=0)
> {noformat}
> In this JIRA, I'll fix this by supporting operator "+" as string concat operator.
> Similar to CALCITE-1374 and CALCITE-1897.



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