-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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] Annotate all functions #103686
[ES|QL] Annotate all functions #103686
Conversation
Pinging @elastic/es-analytics-geo (Team:Analytics) |
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.
How thoughtful! Thanks so much for this. I've left a small comment about your change to the length tests, but otherwise it's great.
I admit I haven't looked super closely at the words, but just having words is a huge improvement over where we are.
new TestCaseSupplier("6 bytes, 2 code points", () -> makeTestCaseAsKeyword("❗️", 2)), | ||
new TestCaseSupplier("100 random alpha", () -> makeTestCaseAsKeyword(randomAlphaOfLength(100), 100)), | ||
new TestCaseSupplier("100 random code points", () -> makeTestCaseAsKeyword(randomUnicodeOfCodepointLength(100), 100)), | ||
new TestCaseSupplier("ascii string as text", () -> makeTestCaseAsText("clump", 5)) |
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.
I suppose we could make both text and keyword in the function and return both.
It tends to be easier to do:
List<TestCase> cases = new ArrayList<>();
cases.addAll(makeTestCases("empty string", 0, () -> ""));
cases.addAll(makeTestCases("100 random alpha", 100, () -> randomAlphaOfLength(100)));
I used to do with the List.of
but for these it's just a pain.
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.
I see what you mean, so makeTestCases
would produce two tests. Ok, I'll update it.
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.
Fixed by cf5061a . Thanks @luigidellaquila for support and patience 😅 .
to_ver |"version to_ver(v:keyword|text|version)" |v |"keyword|text|version" | |version | |false |false | ||
to_version |"version to_version(v:keyword|text|version)" |v |"keyword|text|version" | |version | |false |false | ||
trim |"keyword|text trim(str:keyword|text)" |str |"keyword|text" | "" |"keyword|text" |Removes leading and trailing whitespaces from a string.| false | false | ||
name:keyword | synopsis:keyword | argNames:keyword | argTypes:keyword | argDescriptions:keyword |returnType:keyword | description:keyword | optionalArgs:boolean | variadic:boolean | isAggregation:boolean |
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.
I'm sorry for how this test ends up looking. It's quite a lot.
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.
I was surprised to see that there's no update task for this kind of snapshot tests. I think it would be feasible to create one.
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.
Yeah. I do these one at a time so I just manage it by hand. It isn't like this blob is really code reviewable either.
I do think we should do something about this. Or at least think about it.
@@ -63,6 +63,7 @@ public List<List<Object>> values(FunctionRegistry functionRegistry) { | |||
row.add(signature.description()); | |||
row.add(collect(signature, EsqlFunctionRegistry.ArgSignature::optional)); | |||
row.add(signature.variadic()); | |||
row.add(signature.isAggregation()); |
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.
@luigidellaquila is this one ok with you?
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.
Yes, absolutely fine
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.
Looks good to me.
"cartesian_point" } | ||
"text", | ||
"unsigned_long", | ||
"version" } |
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.
I wonder if we can write a checkstyle rule that forces these to be alphabetical!
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.
LGTM, thank you very much Marco!
* Functions E-Z * Incorporate changes from #103686 * More functions * More functions * Update docs/reference/esql/functions/floor.asciidoc Co-authored-by: Liam Thompson <[email protected]> * Update docs/reference/esql/functions/left.asciidoc Co-authored-by: Liam Thompson <[email protected]> * Apply suggestions from code review Co-authored-by: Alexander Spies <[email protected]> * Review feedback * Fix geo_shape description * Change 'colum'/'field' into 'expressions' * Review feedback * One more --------- Co-authored-by: Liam Thompson <[email protected]> Co-authored-by: Alexander Spies <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
…04623) * Functions E-Z * Incorporate changes from elastic#103686 * More functions * More functions * Update docs/reference/esql/functions/floor.asciidoc Co-authored-by: Liam Thompson <[email protected]> * Update docs/reference/esql/functions/left.asciidoc Co-authored-by: Liam Thompson <[email protected]> * Apply suggestions from code review Co-authored-by: Alexander Spies <[email protected]> * Review feedback * Fix geo_shape description * Change 'colum'/'field' into 'expressions' * Review feedback * One more --------- Co-authored-by: Liam Thompson <[email protected]> Co-authored-by: Alexander Spies <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
Annotate all functions to have full signature available in
SHOW FUNCTIONS
.Fixes #99853 and part of #100621
All available functions are now correctly annotated with types, and an additional
isAggregation
column has been added to the returned table.Few assumptions made for the annotations:
keyword|text
, unless they accepts enum strings in which case I've used thekeyword
type only.date_extract
)There are few notable exceptions to the annotation completeness who I have not been able to fix, so I've partially annotated them:
coalesce
updated with recentmv_sum
main
commit.round
mv_dedupe
I'll create a separate issue for them.