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

Yu Xu commented on CALCITE-7613:
--------------------------------

Thank you for the suggestions. The current Jira is indeed unreasonable for the 
following reasons:
1. The first argument of `CONCAT_WS` is a separator, whereas my original 
intention was to concatenate the input arguments directly; [~mbudiu] 
2. While `SqlLibraryOperators.CONCAT_FUNCTION` supports multiple arguments, I 
wanted the `||` operator to support multiple arguments as well—which, as 
[~julianhyde] said, is not reasonable.
Given the above, this Jira ticket is unnecessary, and I plan to close it in 
coming days.

> Support multi-operand CONCAT operator
> -------------------------------------
>
>                 Key: CALCITE-7613
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7613
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.42.0
>            Reporter: Yu Xu
>            Assignee: Yu Xu
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 1.43.0
>
>
> Currently, Calcite's CONCAT operator (the || string concatenation operator) 
> is defined as a SqlBinaryOperator, which restricts it to exactly two operands 
> at the RexNode level. 
> This limitation forces users to manually construct nested CONCAT calls or use 
> workarounds when dealing with multiple string concatenations.
> When attempting to concatenate more than two strings:
> {code:java}
>   -- Desired SQL (currently fails at RexNode construction)
>   SELECT CONCAT('Hello', ' ', 'World', '!');
>   -- Or using the || operator
>   SELECT 'Hello' || ' ' || 'World' || '!';   {code}
> If you try to construct  3+ operands it would error out:
> {code:java}
> wrong operand count 3 for ||
>  {code}
> Mainstream databases today, such as PostgreSQL and Oracle, support 
> multi-argument `CONCAT`.
> postgresql:[https://onecompiler.com/postgresql/44sufvv78]
> oracle:https://onecompiler.com/plsql/44sufwevp



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

Reply via email to