-
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
EQL: Update between() case handling and tests #59738
Conversation
Pinging @elastic/es-ql (:Query Languages/EQL) |
I'll be on PTO in the upcoming weeks so I removed myself from the reviewers list. Thanks, |
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, but maybe add some test that if either of the args is null => null is returned.
And from what I see we need to update the docs to describe that null behaviour.
...est/java/org/elasticsearch/xpack/eql/expression/function/scalar/string/StringUtilsTests.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/eql/src/test/java/org/elasticsearch/xpack/eql/planner/QueryFolderFailTests.java
Show resolved
Hide resolved
@rw-access Please don't forget ^^ . |
@matriv re: null behavior I was relying on these tests elasticsearch/x-pack/plugin/eql/src/test/resources/test_string_functions.toml Lines 1 to 58 in e9b1fa5
but I'll add more tests to Line 81 in 5c978ac
|
Ah, I see, not insisting, just it would be nice to have a couple in Java unit tests too. |
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 in general. I agree with @matriv about Java unit tests. The more, the better.
Also, it's surprising to me that the case sensitivity for between
didn't make it for the first (experimental) release of eql.
@@ -40,7 +40,7 @@ public EqlFunctionRegistry() { | |||
// Scalar functions | |||
// String | |||
new FunctionDefinition[] { | |||
def(Between.class, Between::new, 2, "between"), |
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.
Since the number of optional parameters is not needed anymore, maybe we should remove it from FunctionRegistry.
@elasticmachine update branch |
Closes #56749
between()
function configuration aware and remove the deprecatedcase_sensitive
argument.null
handling to pass tests and match this specificationgreedy
is unspecified, then it is set tofalse
(unchanged)source
,left
,right
,greedy
) arenull
, then the function will return nullleft
is not in the stringsource
orright
is not in the stringsource
, thennull
is returnedright
is an empty string andgreedy
is true, then the rest of the string afterleft
is consumed