Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] CONCAT on more than two strings #1053

Closed
acarbonetto opened this issue Nov 8, 2022 · 3 comments · Fixed by #1279
Closed

[FEATURE] CONCAT on more than two strings #1053

acarbonetto opened this issue Nov 8, 2022 · 3 comments · Fixed by #1279
Labels

Comments

@acarbonetto
Copy link
Collaborator

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

@acarbonetto acarbonetto added enhancement New feature or request untriaged labels Nov 8, 2022
@dai-chen
Copy link
Collaborator

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

@Yury-Fridlyand
Copy link
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)

@margarit-h
Copy link
Contributor

PR: #1279

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants