-
Notifications
You must be signed in to change notification settings - Fork 186
Support LIKE operator #534
Support LIKE operator #534
Conversation
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.
Besides IT, could you add a doctest for this?
...c/main/java/com/amazon/opendistroforelasticsearch/sql/expression/operator/OperatorUtils.java
Outdated
Show resolved
Hide resolved
...on/opendistroforelasticsearch/sql/expression/operator/predicate/BinaryPredicateOperator.java
Outdated
Show resolved
Hide resolved
Thanks @dai-chen ! The doc of operators have not been created/updated, can I add the doc test when adding the experimental doc in another PR? |
Sure, no problem! Next time probably we can start from doc to drive the coding and save the trouble of adding all docs at last. :) |
# Conflicts: # core/src/main/java/com/amazon/opendistroforelasticsearch/sql/expression/DSL.java
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. Thanks!
|
||
private static final char DEFAULT_ESCAPE = '\\'; | ||
|
||
private static String patternToRegex(String patternString) { |
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.
- could you seperate it from OperatorUtils in case is more focus on SQL regex to Java regex.
- by define the ESCAPE is defined in SQL language, how do we support it?
- is it possible to seperate the translation rule from translation logic.
for example,
TranslationRule.Buidler.put("//%", %").put("%", ".*").build()
Then, apply rule on the input REGEX.
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
Issue #, if available:
Description of changes:
Syntax:
string like pattern
The pattern supports string literal with percent(
%
) character for wildcard and underscore(_
) character for single character. Here are some examples:foobar like 'foobar%'
-> truefoobar like '%bar'
-> truefoobar like '%BAR'
-> falsefoobar like 'fooba_'
-> truefoobar like 'foobar_'
-> falsefoobar like '%ba_'
-> trueFor null values and missing values in LIKE operation, the results follows AsterixDB standard:
Reference: CrateDB
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.