-
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
QL: case sensitive support in EQL #56404
Conversation
* Added case sensitivity to EQL configuration * case_sensitive parameter can be specified when running queries (default is case insensitive) * Added STARTS_WITH function to SQL as well
…o 55340_enhancement3
…o 55340_enhancement3
Pinging @elastic/es-ql (:Query Languages/EQL) |
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, left some comments mostly minor.
.../src/main/java/org/elasticsearch/xpack/eql/expression/function/scalar/string/StartsWith.java
Show resolved
Hide resolved
x-pack/plugin/eql/src/main/resources/org/elasticsearch/xpack/eql/plugin/eql_whitelist.txt
Show resolved
Hide resolved
x-pack/plugin/eql/src/test/java/org/elasticsearch/xpack/eql/analysis/VerifierTests.java
Outdated
Show resolved
Hide resolved
...rg/elasticsearch/xpack/ql/expression/function/scalar/string/StartsWithFunctionPipeTests.java
Show resolved
Hide resolved
x-pack/plugin/sql/src/main/resources/org/elasticsearch/xpack/sql/plugin/sql_whitelist.txt
Show resolved
Hide resolved
|
||
public StartsWithFunctionProcessor(Processor source, Processor pattern) { | ||
public StartsWithFunctionProcessor(Processor source, Processor pattern, boolean isCaseSensitive) { |
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.
Maybe remove the Function
as we don't normally use it in processor names.
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.
There are functions where this pattern is used - String functions.
@@ -17,13 +17,15 @@ | |||
|
|||
public class StartsWithFunctionPipe extends Pipe { |
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.
Maybe remove Function
from the name.
x-pack/plugin/eql/src/test/java/org/elasticsearch/xpack/eql/planner/QueryFolderOkTests.java
Show resolved
Hide resolved
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.
Left a few comments but looks good to me otherwise.
Thanks for the various cleanups.
@@ -22,7 +22,7 @@ | |||
import org.elasticsearch.xpack.sql.planner.Planner; | |||
import org.elasticsearch.xpack.sql.planner.PlanningException; | |||
import org.elasticsearch.xpack.sql.proto.SqlTypedParamValue; | |||
import org.elasticsearch.xpack.sql.session.Configuration; |
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.
What's the advantage of using Configuration
instead of SqlConfiguration
?
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.
This is just a rename. The SQL's Configuration => SqlConfiguration.
The same for Eql. EQL's Configuration was renamed to EqlConfiguration.
I found it a bit confusing to have Configuration in three separate projects.
...org/elasticsearch/xpack/sql/expression/function/scalar/NoArgumentsConfigurationFunction.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/session/EqlSession.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/elasticsearch/xpack/eql/expression/function/scalar/string/StartsWith.java
Show resolved
Hide resolved
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. left 2 minor formatting comments.
pipe(((Expression) randomValueOtherThan(f.field(), () -> randomStringLiteral()))), | ||
pipe(((Expression) randomValueOtherThan(f.pattern(), () -> randomStringLiteral()))), | ||
f.isCaseSensitive())); | ||
for(int i = 1; i < 4; i++) { |
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.
for(int i = 1; i < 4; i++) { | |
for (int i = 1; i < 4; i++) { |
pipe(((Expression) randomValueOtherThan(f.pattern(), () -> randomStringLiteral()))), | ||
f.isCaseSensitive())); | ||
for(int i = 1; i < 4; i++) { | ||
for(BitSet comb : new Combinations(3, i)) { |
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.
for(BitSet comb : new Combinations(3, i)) { | |
for (BitSet comb : new Combinations(3, i)) { |
* adds a generic startsWith function to QL * modifies the existent EQL startsWith function to be case sensitive aware * improves the existent EQL startsWith function to use a prefix query when the function is used in a case sensitive context. Same improvement is used in SQL's newly added STARTS_WITH function. * adds case sensitivity to EQL configuration through a case_sensitive parameter in the eql request, as established in elastic#54411. The case_sensitive parameter can be specified when running queries (default is case insensitive) (cherry picked from commit ee5a09e)
* QL: case sensitive support in EQL (#56404) * adds a generic startsWith function to QL * modifies the existent EQL startsWith function to be case sensitive aware * improves the existent EQL startsWith function to use a prefix query when the function is used in a case sensitive context. Same improvement is used in SQL's newly added STARTS_WITH function. * adds case sensitivity to EQL configuration through a case_sensitive parameter in the eql request, as established in #54411. The case_sensitive parameter can be specified when running queries (default is case insensitive) (cherry picked from commit ee5a09e)
This PR adds several enhancements:
prefix
query when the function is used in a case sensitive context. Same improvement is used in SQL's newly added STARTS_WITH function.case_sensitive
parameter in the eql request, as established in EQL: case sensitivity in ES EQL string functions #54411. Thecase_sensitive
parameter can be specified when running queries (default is case insensitive)What this PR is not covering:
Fixes #55340.
Relates to #54411.