feat: add support for utilising text indexes if exits for like operator in pinot based handlers#186
Merged
kotharironak merged 6 commits intomainfrom Jun 13, 2023
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## main #186 +/- ##
============================================
+ Coverage 78.68% 78.80% +0.11%
- Complexity 887 898 +11
============================================
Files 80 80
Lines 3626 3651 +25
Branches 413 419 +6
============================================
+ Hits 2853 2877 +24
Misses 598 598
- Partials 175 176 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
kotharironak
commented
Jun 13, 2023
| return REGEX_OPERATOR; | ||
| } | ||
|
|
||
| private Expression prefixValueForLikeOperator(String likeOperatorStr, Expression rhsExpression) { |
Contributor
Author
There was a problem hiding this comment.
For TEXT_MATCH regex query needs string to be prefixed and suffixed with '/'.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| operator = handleLikeOperatorConversion(filter.getLhs()); | ||
| Expression rhs = | ||
| handleValueConversionForLiteralExpression(filter.getLhs(), filter.getRhs()); | ||
| rhs = postProcessValueConversionForLikeOperator(operator, rhs); |
Contributor
There was a problem hiding this comment.
nit: rather than taking multiple steps to calculate the RHS in the top level, could you do something like
operator = handleLikeOperatorConversion(filter.getLhs());
Expression rhs =
handleValueConversionForLikeArgument(filter.getLhs(), filter.getRhs());and then have handleValueConversionForLikeArgument do the delegation.
| private Expression postProcessValueConversionForLikeOperator( | ||
| String likeOperatorStr, Expression rhsExpression) { | ||
| if (likeOperatorStr.equals(TEXT_MATCH_OPERATOR)) { | ||
| String strValue = "/" + rhsExpression.getLiteral().getValue().getString() + "/"; |
Contributor
There was a problem hiding this comment.
nit: this could be simplified a bit by just starting from the input.
Builder builder = rhsExpression.toBuilder()
if (condition) {
builder.getLiteralBuilder().getValueBuilder().setString(...);
}
return builder.build();
This comment has been minimized.
This comment has been minimized.
aaron-steinfeld
approved these changes
Jun 13, 2023
This comment has been minimized.
This comment has been minimized.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR add support for utilising text indexes for LIKE operator for pinot based request handler if the index for those column is enabled. So, the string column with index will translated to
Testing
Checklist: