Skip to content

Commit

Permalink
[ES|QL] case only requires two parameters (elastic#179011)
Browse files Browse the repository at this point in the history
## Summary

Part of elastic#177699

We had `case` marked as if it required three parameters when in reality
it only requires two.

<img width="600" alt="Screenshot 2024-03-19 at 4 23 29 PM"
src="https://github.com/elastic/kibana/assets/315764/45f7578a-e6ad-4ba9-b71a-05bb1978a384">

Note: we could consider testing these n-1 cases to prevent this kind of
bug in the future.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 21, 2024
1 parent 1b90076 commit 28277c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ export const evalFunctionsDefinitions: FunctionDefinition[] = [
{ name: 'condition', type: 'boolean' },
{ name: 'value', type: 'any' },
],
minParams: 3,
minParams: 2,
returnType: 'any',
examples: [
`from index | eval type = case(languages <= 1, "monolingual", languages <= 2, "bilingual", "polyglot")`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,11 +563,11 @@
"error": false
},
{
"query": "row var = case(true, \"a\", \"a\")",
"query": "row var = case(true, \"a\")",
"error": false
},
{
"query": "row case(true, \"a\", \"a\")",
"query": "row case(true, \"a\")",
"error": false
},
{
Expand Down Expand Up @@ -4871,11 +4871,11 @@
"error": true
},
{
"query": "from a_index | eval var = case(booleanField, stringField, stringField)",
"query": "from a_index | eval var = case(booleanField, stringField)",
"error": false
},
{
"query": "from a_index | eval case(booleanField, stringField, stringField)",
"query": "from a_index | eval case(booleanField, stringField)",
"error": false
},
{
Expand Down

0 comments on commit 28277c2

Please sign in to comment.