Intersect pushdown predicates#13505
Merged
rschlussel merged 1 commit intoprestodb:masterfrom Oct 16, 2019
Merged
Conversation
highker
reviewed
Oct 9, 2019
There was a problem hiding this comment.
Could you move this function inside HiveMetadata? Let's make the spi light-weighted.
c6d61a6 to
3e4e352
Compare
Author
|
OK.
For future reference, you will likely want ExtractionResult.intersect In spi for symmetry with TupleDomain and because every other connector is likely to need this same thing.
From: James Sun <notifications@github.com>
Sent: Tuesday, October 8, 2019 7:35 PM
To: prestodb/presto <presto@noreply.github.com>
Cc: oerling <erling@xs4all.nl>; Author <author@noreply.github.com>
Subject: Re: [prestodb/presto] Intersect pushdown predicates (#13505)
@highker commented on this pull request.
minor comments
_____
In presto-spi/src/main/java/com/facebook/presto/spi/relation/DomainTranslator.java <#13505 (comment)> :
@@ -55,6 +56,21 @@ public ExtractionResult(TupleDomain<T> tupleDomain, RowExpression remainingExpre
this.remainingExpression = requireNonNull(remainingExpression, "remainingExpression is null");
}
+ public ExtractionResult intersect(ExtractionResult other)
Could you move this function inside HiveMetadata? Let's make the spi light-weighted.
_____
In presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java <#13505 (comment)> :
ExtractionResult<Subfield> decomposedFilter = rowExpressionService.getDomainTranslator()
.fromPredicate(session, filter, new SubfieldExtractor(functionResolution, rowExpressionService.getExpressionOptimizer(), session).toColumnExtractor());
-
+ if (currentLayoutHandle.isPresent()) {
+ HiveTableLayoutHandle currentHiveLayout = (HiveTableLayoutHandle) currentLayoutHandle.get();
+ decomposedFilter = decomposedFilter.intersect(new ExtractionResult(currentHiveLayout.getDomainPredicate(), currentHiveLayout.getRemainingPredicate()));
+ }
Put an empty line after this.
_____
In presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java <#13505 (comment)> :
Map<String, ColumnHandle> columnHandles = getColumnHandles(session, tableHandle);
TupleDomain<ColumnHandle> entireColumnDomain = decomposedFilter.getTupleDomain()
.transform(subfield -> isEntireColumn(subfield) ? subfield.getRootName() : null)
.transform(columnHandles::get);
- // TODO Extract deterministic conjuncts that apply to partition columns and specify these as Contraint#predicate
+ if (currentLayoutHandle.isPresent()) {
+ entireColumnDomain = entireColumnDomain.intersect(((HiveTableLayoutHandle) (currentLayoutHandle.get())).getPartitionColumnPredicate());
+ }
Put an empty line after this.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#13505?email_source=notifications&email_token=AKPPPT6MFYE3JIKQELWCYOTQNU7MRA5CNFSM4I6ABKJKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCHKI2PQ#pullrequestreview-299142462> , or mute the thread <https://github.com/notifications/unsubscribe-auth/AKPPPT6RRHKQ722GGOMLZZDQNU7MRANCNFSM4I6ABKJA> .
|
3e4e352 to
7dc9f12
Compare
Author
|
Could you or James merge this?
Thanks
Orri
From: Rebecca Schlussel <notifications@github.com>
Sent: Friday, October 11, 2019 8:06 AM
To: prestodb/presto <presto@noreply.github.com>
Cc: oerling <erling@xs4all.nl>; Author <author@noreply.github.com>
Subject: Re: [prestodb/presto] Intersect pushdown predicates (#13505)
@rschlussel approved this pull request.
looks good, thanks.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#13505?email_source=notifications&email_token=AKPPPT4H6FDNV6T4ULIWB5LQOCI5RA5CNFSM4I6ABKJKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCHWQ4FQ#pullrequestreview-300748310> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AKPPPTZN7T4HCCVBV2KXMNLQOCI5RANCNFSM4I6ABKJA> .
|
Contributor
|
@highker did you have any additional comments? |
|
@oerling, could you rebase so we could merge? |
Predicates can be pushed down into a scan multiple times, for example when a CTE has local predicates initially and acquires new predicates from the enclosing context. Adds an intersect method to DomainTranslater.ExtractionResult.
7dc9f12 to
f2e1b4b
Compare
Author
|
OK, rebased.
From: James Sun <notifications@github.com>
Sent: Wednesday, October 16, 2019 10:35 AM
To: prestodb/presto <presto@noreply.github.com>
Cc: oerling <erling@xs4all.nl>; Mention <mention@noreply.github.com>
Subject: Re: [prestodb/presto] Intersect pushdown predicates (#13505)
@oerling <https://github.com/oerling> , could you rebase so we could merge?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#13505?email_source=notifications&email_token=AKPPPT5ITWXDOPWN7YPSRMTQO5GDDA5CNFSM4I6ABKJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBNJ7MY#issuecomment-542810035> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AKPPPT4KND2LHH3E23HCL7LQO5GDDANCNFSM4I6ABKJA> .
|
This was referenced Nov 11, 2019
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.
Predicates can be pushed down into a scan multiple times, for example
when a CTE has local predicates initially and acquires new predicates
from the enclosing context. Adds an intersect method to
DomainTranslater.ExtractionResult.