-
Notifications
You must be signed in to change notification settings - Fork 25k
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
[ES|QL][SHOW FUNCTION] Change variadic annotation to minArgs #106222
Conversation
Pinging @elastic/es-analytical-engine (Team:Analytics) |
Hi @dej611, I've created a changelog YAML for you. |
@@ -23,4 +23,6 @@ | |||
String description() default ""; | |||
|
|||
boolean isAggregation() default false; | |||
|
|||
String minArgs() default ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type and what it represents is confusing. minArgs
indicates a number while the type is String?
And looking at show.csv-spec
I see mostly null
values and here and there 1
for minArgs
. What does null
represent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the minArgs
values defined:
concat
: 2case
:32coalesce
: 1greatest
: 1least
: 1cidr_match
: 2
I had to adopt null
here to make tests pass. Empty values were my initial implementation but tests were complaining. With null
it passes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type and what it represents is confusing. minArgs indicates a number while the type is String?
I thought about adopting int
at first, but given its small footprint using String
avoided changes for most part of the code around. I can refactor to it, hoping all the testing logic won't be too affected.
Also, why |
I think the misunderstanding is the naming I've chosen here. Perhaps |
We discussed this offline and the |
This does not seem to be correct. For Perhaps minArgs is:
|
@craigtaverner fair point, but I think the problem is with the
and yes,
In conclusion:
I've created #106346. After we review all functions, the rule for "minimum number of required arguments" will be |
When
And here's a list of the expected minArgs vs current value when
I see here 3 possible ways to solve this challenge:
|
Change the
variadic
column (boolean) into the numericminArgs
column.Fix part of #100621 and #106200 .
Why this change?
ES|QL has few variadic functions, but some of them requires a minimum number of args and this information is not provided elsewhere other than the code itself.
The
minArgs
annotation is a superset of thevariadic
one (equivalent tominArgs > 0
) and it provides additional information about the minimum number of arguments a variadic function accepts.With this change any client (i.e. Kibana) can leverage this information to provide better services for ES|QL functions (i.e. validation, autocomplete, etc...).