Yu Xu created CALCITE-7613:
------------------------------

             Summary: 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
             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