-
Notifications
You must be signed in to change notification settings - Fork 8
feat : Addition of API support for receiving attribute expressions #126
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
Changes from 7 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
74de0f2
added sup for attr expr in execution context
61f141c
added sup for attr expr in projection transformation
d88110b
Merge remote-tracking branch 'origin/main' into feat_api_support_for_…
8bf4b47
added sup for attr expr in pinotbasedrequesthandler
0eedfb7
refactored
78b71d0
added unit test for execution context
5ed48e4
added unit test in pinot based rqst handler
0233401
changed function signature
8f25119
resolved comments
a613792
nit
4603ef8
fixed unit tests
a1b9cfe
added template for new tests
46132ca
added integ test with attr expr for existing queries
75aad05
added functions for integ test
0a57dd9
added new integ tests
929e3c9
nit
d51263a
added contains key filter for selection
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| package org.hypertrace.core.query.service.pinot; | ||
|
|
||
| import static org.hypertrace.core.query.service.ConfigUtils.optionallyGet; | ||
| import static org.hypertrace.core.query.service.QueryRequestUtil.getLogicalColumnName; | ||
|
|
||
| import com.google.common.base.Preconditions; | ||
| import com.google.common.base.Stopwatch; | ||
|
|
@@ -225,10 +226,12 @@ && rhsHasLongValue(filter.getRhs())) { | |
| } | ||
|
|
||
| private boolean lhsIsStartTimeAttribute(Expression lhs) { | ||
| return lhs.hasColumnIdentifier() | ||
| && startTimeAttributeName | ||
| .map(attributeName -> attributeName.equals(lhs.getColumnIdentifier().getColumnName())) | ||
| .orElse(false); | ||
| if (lhs.hasColumnIdentifier() || lhs.hasAttributeExpression()) { | ||
aaron-steinfeld marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return startTimeAttributeName | ||
| .map(attributeName -> attributeName.equals(getLogicalColumnName(lhs))) | ||
| .orElse(false); | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| private boolean rhsHasLongValue(Expression rhs) { | ||
|
|
@@ -245,7 +248,7 @@ private Set<String> getMatchingViewFilterColumns( | |
| // return it. | ||
| if (filter.getChildFilterCount() == 0) { | ||
| return doesSingleViewFilterMatchLeafQueryFilter(viewFilterMap, filter) | ||
| ? Set.of(filter.getLhs().getColumnIdentifier().getColumnName()) | ||
| ? Set.of(getLogicalColumnName(filter.getLhs())) | ||
|
||
| : Set.of(); | ||
| } else { | ||
| // 2. Internal filter node. Recursively get the matching nodes from children. | ||
|
|
@@ -274,14 +277,15 @@ private Set<String> getMatchingViewFilterColumns( | |
| */ | ||
| private boolean doesSingleViewFilterMatchLeafQueryFilter( | ||
| Map<String, ViewColumnFilter> viewFilterMap, Filter queryFilter) { | ||
| if (queryFilter.getLhs().getValueCase() != ValueCase.COLUMNIDENTIFIER) { | ||
| if (queryFilter.getLhs().getValueCase() != ValueCase.COLUMNIDENTIFIER | ||
aaron-steinfeld marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| && queryFilter.getLhs().getValueCase() != ValueCase.ATTRIBUTE_EXPRESSION) { | ||
| return false; | ||
| } | ||
| if (queryFilter.getOperator() != Operator.IN && queryFilter.getOperator() != Operator.EQ) { | ||
| return false; | ||
| } | ||
|
|
||
| String columnName = queryFilter.getLhs().getColumnIdentifier().getColumnName(); | ||
| String columnName = getLogicalColumnName(queryFilter.getLhs()); | ||
| ViewColumnFilter viewColumnFilter = viewFilterMap.get(columnName); | ||
| if (viewColumnFilter == null) { | ||
| return false; | ||
|
|
@@ -469,7 +473,7 @@ private Filter removeViewColumnFilter( | |
| private Filter rewriteLeafFilter( | ||
| Filter queryFilter, Map<String, ViewColumnFilter> columnFilterMap) { | ||
| ViewColumnFilter viewColumnFilter = | ||
| columnFilterMap.get(queryFilter.getLhs().getColumnIdentifier().getColumnName()); | ||
| columnFilterMap.get(getLogicalColumnName(queryFilter.getLhs())); | ||
| // If the RHS of both the view filter and query filter match, return empty filter. | ||
| if (viewColumnFilter != null && isEquals(viewColumnFilter.getValues(), queryFilter.getRhs())) { | ||
| return Filter.getDefaultInstance(); | ||
|
|
||
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
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
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
Oops, something went wrong.
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.
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.
Is value type always string and never repeated? Looks pre-existing, but pretty sure this is a bug. Can come back to it.