Skip to content

[FEATURE] CONCAT on more than two strings #1053

Closed

Description

@acarbonetto

Is your feature request related to a problem?

curl --location --request POST 'http://localhost:9200/_plugins/_sql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--data-raw '{
    "query": "SELECT concat(\"hello \", \"world\", \"!\") FROM calcs"
}'

returns:

{
  "error": {
    "reason": "Invalid SQL query",
    "details": "concat function expected {[STRING,STRING]}, but get [STRING,STRING,STRING]",
    "type": "ExpressionEvaluationException"
  },
  "status": 400
}

What solution would you like?
Expect the concatenated result: hello world!

What alternatives have you considered?
Nested queries do work, such as:

{
    "query": "SELECT concat(concat(\"abc\", \"def\"), \"ghi\");"
}

returns:

"abcdefghi"

Do you have any additional context?
n/a

Activity

  1. added
    enhancement
    on Nov 8, 2022
  2. dai-chen commented on Dec 14, 2022

    @dai-chen
    Collaborator

    This may need varargs support or array type which are missing now.

  3. Yury-Fridlyand commented on Dec 14, 2022

    @Yury-Fridlyand
    Collaborator

    At least we can add concat signatures which accept up to 5-8 args and update doc. A user who wants more can use nested call: concat(concat(1, 2, 3, 4), 5, 6, 7, 8)

  4. margarit-h commented on Jan 13, 2023

    @margarit-h
    Contributor

    PR: #1279

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bi-toolingenhancementv2.6.0

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions