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/16 12:53:00 UTC
[jira] [Updated] (CALCITE-5771) Apply two different NULL semantics for CONCAT function(enabled in MySQL, Postgresql, BigQuery and MSSQL)
[ https://issues.apache.org/jira/browse/CALCITE-5771?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ZheHu updated CALCITE-5771:
---------------------------
Description:
We now have one CONCAT_FUNCTION which is enabled in MySQL, Postgresql, BigQuery, it always returns NULL when any of the arguments is NULL, and it accepts at least 2 arguments.
The following table describes how different database products define CONCAT function:
||DB Product||Argument type in CONCAT||Argument num in CONCAT||Result||
|MySQL|string|at least 1|returns null if any argument is null, otherwise return string|
|BigQuery|string|at least 1|returns null if any argument is null, otherwise return string|
|Postgresql|any(cast to string)|at least 1|always return string, null is treated as empty string|
|MSSQL|string|2 ~ 254|always return string, null is treated as empty string|
For MySQL and BigQuery, we can reuse the current CONCAT_FUNCTION(but need to change the accepted argument number). We also need another CONCAT function for Postgresql and MSSQL that treats NULL as empty String. And they both accept at least 1 argument.
was:
We now have one CONCAT_FUNCTION which is enabled in MySQL、Postgresql、BigQuery, it always returns NULL when any of the arguments is NULL, and it accepts at least 2 arguments.
The following table describes how different database products define CONCAT function:
|| DB Product || Argument type in CONCAT || Argument num in CONCAT || Result ||
|MySQL|string|at least 1|returns null if any argument is null, otherwise return string|
|BigQuery|string|at least 1|returns null if any argument is null, otherwise return string|
|Postgresql|any(cast to string)|at least 1|always return string, null is treated as empty string|
|MSSQL|string|2 ~ 254|always return string, null is treated as empty string|
For MySQL and BigQuery, we can reuse the current CONCAT_FUNCTION(but need to change the accepted argument number). We also need another CONCAT function for Postgresql and MSSQL that treats NULL as empty String. And they both accept at least 1 argument.
> Apply two different NULL semantics for CONCAT function(enabled in MySQL, Postgresql, BigQuery and MSSQL)
> --------------------------------------------------------------------------------------------------------
>
> Key: CALCITE-5771
> URL: https://issues.apache.org/jira/browse/CALCITE-5771
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.34.0
> Reporter: ZheHu
> Assignee: ZheHu
> Priority: Major
> Labels: pull-request-available
>
> We now have one CONCAT_FUNCTION which is enabled in MySQL, Postgresql, BigQuery, it always returns NULL when any of the arguments is NULL, and it accepts at least 2 arguments.
> The following table describes how different database products define CONCAT function:
> ||DB Product||Argument type in CONCAT||Argument num in CONCAT||Result||
> |MySQL|string|at least 1|returns null if any argument is null, otherwise return string|
> |BigQuery|string|at least 1|returns null if any argument is null, otherwise return string|
> |Postgresql|any(cast to string)|at least 1|always return string, null is treated as empty string|
> |MSSQL|string|2 ~ 254|always return string, null is treated as empty string|
> For MySQL and BigQuery, we can reuse the current CONCAT_FUNCTION(but need to change the accepted argument number). We also need another CONCAT function for Postgresql and MSSQL that treats NULL as empty String. And they both accept at least 1 argument.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)