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

Julian Hyde commented on CALCITE-7613:
--------------------------------------

Calcite already has a CONCAT function. SqlLibraryOperators.CONCAT_FUNCTION. Why 
did you not mention this?

Can you be clear whether you are talking about SQL-level changes or internal 
changes? It's impossible to write SQL that gives '||", an infix operator, more 
than two arguments.

> 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