Fire PushPredicateIntoTableScan rule with change in TableHandle#3470
Merged
martint merged 5 commits intotrinodb:masterfrom Apr 23, 2020
Merged
Fire PushPredicateIntoTableScan rule with change in TableHandle#3470martint merged 5 commits intotrinodb:masterfrom
martint merged 5 commits intotrinodb:masterfrom
Conversation
58c1602 to
2941c56
Compare
martint
reviewed
Apr 21, 2020
...o-main/src/main/java/io/prestosql/sql/planner/iterative/rule/PushPredicateIntoTableScan.java
Outdated
Show resolved
Hide resolved
2941c56 to
d0e0ed0
Compare
3f7e2aa to
28180d9
Compare
Member
Author
|
I've verified equals and hashCode methods for all Also added TableHandle equality method to address #3470 (comment). Using TableHandle comparison requires I've added the changes as separate commits right now for ease of review, will coalesce them into one if this feels noisy. |
martint
approved these changes
Apr 22, 2020
Compare table handles representing the same logical dataset as equal
3f3554a to
df81674
Compare
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.
If there's a constraint in the filter node that the connector can "enforce", PushPredicateIntoTableScan modifies the plan to incorporate the new scan and residue filter.
In case of non-partition pushdown for hive, this is not true. The "compactEffectivePredicate" added to the table handle may or may not be satisfied by the HivePageSource (eg. ORC vs Avro). So we cannot get rid of those predicates from the FilterNode. But even though
HiveMetadata::applyFilterreturns a ConstraintApplicationResult, PushPredicateIntoTableScan throws it away, sincearePlansSamedoesn't consider change in table handles, if the enforced constraint hasn't changed. eg. Test added inTestConnectorPushdownRulesWithHivefails without this change.Predicates on top level columns still get pushed down to ORC/Parquet without this change, because
AddExchanges::visitFilteradds the predicates, but I think the predicates should get pushed down in PushPredicateIntoTableScan.I added connector table handle comparison in
arePlansSame. (That failed some tests initially due to the fact that BucketFilter equality was object reference based, now they pass). But I'm not sure if comparing connector table handles is okay, or we need a better approach to tell that there was "some level" of predicate pushdown, even if it's not guaranteed to be enforced.This change is also required for #1720 and #2672 to work together to pushdown predicates on nested columns.