Skip to content

EQL: Introduce case insensitive variant in~ #68176

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

Merged
merged 2 commits into from
Jan 29, 2021

Conversation

costin
Copy link
Member

@costin costin commented Jan 28, 2021

Complement to in, in~ does case-insensitive matching without any
pattern matching - : should be used instead.

process where name in~ ("ExPLorEr.eXe")

will match name against explorer.exe regardless of case.

Fix #68172

Complement to in, in~ does case-insensitive matching without any
pattern matching - : should be used instead.

process where name in~ ("ExPLorEr.eXe")

will match name against explorer.exe regardless of case.

Fix elastic#68172
@elasticmachine elasticmachine added the Team:QL (Deprecated) Meta label for query languages team label Jan 28, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-ql (Team:QL)

@@ -167,8 +168,13 @@ public Expression visitOperatorExpressionDefault(EqlBaseParser.OperatorExpressio
switch (predicate.kind.getType()) {
case EqlBaseParser.SEQ:
return Predicates.combineOr(expressions(predicate.constant()).stream()
.map(c -> new InsensitiveWildcardEquals(source, expr, c, zoneId))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? shouldn't this be for the IN_INSESITIVE and for SEQ the InsensitiveEquals?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. See the tests - : or SEQ supports wildcards while in~ does not, hence why it is only insensitive.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, sorry, I confused myself.

Copy link
Contributor

@matriv matriv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import org.antlr.v4.runtime.*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert star imports.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks like a side-effect on ANTLR generation.

Copy link
Contributor

@bpintea bpintea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

String wildString = null;
if (cmp instanceof InsensitiveWildcardEquals || cmp instanceof InsensitiveWildcardNotEquals) {
// expr : "wildcard*phrase?" || expr !: "wildcard*phrase?"
Expression result = cmp;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like if you move this outside the branch you could remove the inner return.

Copy link
Contributor

@astefan astefan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@costin costin merged commit dad9025 into elastic:master Jan 29, 2021
@costin costin deleted the eql/insensitive-in branch January 29, 2021 11:19
@costin
Copy link
Member Author

costin commented Jan 29, 2021

/cc @jrodewig

@costin costin removed the v7.12.0 label Jan 29, 2021
costin added a commit that referenced this pull request Jan 29, 2021
Complement to in, in~ does case-insensitive matching without any
pattern matching - : should be used instead.

process where name in~ ("ExPLorEr.eXe")

will match name against explorer.exe regardless of case.

Fix #68172
jrodewig added a commit that referenced this pull request Jan 29, 2021
Documents the case-insensitive `~` operator for `in` and string functions.

Relates to #67869 and #68176
jrodewig added a commit that referenced this pull request Jan 29, 2021
Documents the case-insensitive `~` operator for `in` and string functions.

Relates to #67869 and #68176
@jakelandis jakelandis removed the v8.0.0 label Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/EQL EQL querying >enhancement Team:QL (Deprecated) Meta label for query languages team v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EQL: Introduce in~ (case-insensitive in)
6 participants