-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Introduce LIKE Operator #7214
Introduce LIKE Operator #7214
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7214 +/- ##
=============================================
- Coverage 73.45% 29.80% -43.65%
+ Complexity 92 86 -6
=============================================
Files 1508 1496 -12
Lines 73939 73891 -48
Branches 10682 10697 +15
=============================================
- Hits 54309 22023 -32286
- Misses 16066 49880 +33814
+ Partials 3564 1988 -1576
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
pinot-common/src/main/antlr4/org/apache/pinot/pql/parsers/PQL2.g4
Outdated
Show resolved
Hide resolved
@Jackie-Jiang @mayankshriv Updated the PR, please see and let me know. |
@siddharthteotia Does text match has same semantic as sql like? I thought text match uses the lucene query syntax |
pinot-core/src/test/java/org/apache/pinot/queries/TextSearchQueriesTest.java
Outdated
Show resolved
Hide resolved
Syntax for SQL LIKE: https://www.w3schools.com/sql/sql_like.asp |
pinot-common/src/main/antlr4/org/apache/pinot/pql/parsers/PQL2.g4
Outdated
Show resolved
Hide resolved
TEXT_MATCH uses Lucene query syntax for term, phrase, regex, fuzzy, boolean etc queries. Is SQL LIKE compliant with lucene query syntax ? |
pinot-core/src/test/java/org/apache/pinot/queries/TextSearchQueriesTest.java
Outdated
Show resolved
Hide resolved
pinot-core/src/test/java/org/apache/pinot/queries/TextSearchQueriesTest.java
Outdated
Show resolved
Hide resolved
pinot-core/src/test/java/org/apache/pinot/queries/TextSearchQueriesTest.java
Outdated
Show resolved
Hide resolved
No, it is not. I have updated the PR to reflect the same. |
Thanks @atris for taking this up. can you please add some sample queries to the description and explain what happens before/after this PR. |
Thank you, updated |
pinot-common/src/main/java/org/apache/pinot/common/request/context/predicate/LikePredicate.java
Outdated
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/common/request/context/predicate/LikePredicate.java
Outdated
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/common/request/context/RequestContextUtils.java
Outdated
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/common/request/context/predicate/LikePredicate.java
Outdated
Show resolved
Hide resolved
pinot-core/src/test/java/org/apache/pinot/queries/TextSearchQueriesTest.java
Outdated
Show resolved
Hide resolved
@Jackie-Jiang Please see and let me know your comments |
pinot-common/src/main/java/org/apache/pinot/common/request/context/predicate/Predicate.java
Outdated
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/common/utils/LikeToRegexFormatConverterUtil.java
Outdated
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/common/utils/LikeToRegexFormatConverterUtil.java
Outdated
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/common/utils/LikeToRegexFormatConverterUtil.java
Outdated
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/common/utils/LikeToRegexFormatConverterUtil.java
Outdated
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/common/utils/LikeToRegexFormatConverterUtil.java
Outdated
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/common/utils/LikeToRegexFormatConverterUtil.java
Outdated
Show resolved
Hide resolved
pinot-common/src/test/java/org/apache/pinot/util/TestLikeSyntaxConverter.java
Outdated
Show resolved
Hide resolved
@Jackie-Jiang Please see |
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 otherwise
This commit introduces LIKE operator as defined by SQL92 standard.
Currently, our only way to be matching text fields is to either define regexes and use REGEXP_LIKE or define Lucene syntax and use TEXT_MATCH function.
SQL 92 defines the LIKE operator, which allows for exact matches (FOO like "BAR") and subquery matches (FOO LIKE "%AR").
Having the LIKE operator brings us closer to the SQL standard, allows users to migrate to us in an easier form and allows third party SQL tools to work on top of us.