Skip to content

Conversation

@prakharjain09
Copy link
Contributor

What changes were proposed in this pull request?

This PR fixes issues relate to Canonicalization of FileSourceScanExec when it contains unused DPP Filter.

Why are the changes needed?

As part of PlanDynamicPruningFilter rule, the unused DPP Filter are simply replaced by DynamicPruningExpression(TrueLiteral) so that they can be avoided. But these unnecessaryDynamicPruningExpression(TrueLiteral) partition filter inside the FileSourceScanExec affects the canonicalization of the node and so in many cases, this can prevent ReuseExchange from happening.

This PR fixes this issue by ignoring the unused DPP filter in the def doCanonicalize method.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Added UT.

@prakharjain09 prakharjain09 force-pushed the SPARK-32509_df_reuse branch from df019ce to 6cb0703 Compare July 31, 2020 12:09
@prakharjain09
Copy link
Contributor Author

prakharjain09 commented Jul 31, 2020

@cloud-fan
Copy link
Contributor

ok to test

output.map(QueryPlan.normalizeExpressions(_, output)),
requiredSchema,
QueryPlan.normalizePredicates(partitionFilters, output),
QueryPlan.normalizePredicates(filterUnnecessaryPredicates(partitionFilters), output),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does TrueLiteral affect canonicalize? TrueLiteral == TrueLiteral returns true, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I got it. Maybe one side has DPP and one side not.

Can we filter out DynamicPruningExpression(Literal.TrueLiteral)? Then we don't need to change https://github.com/apache/spark/pull/29318/files#diff-6c00f36fadec282fce72ad39cfea51caL81 and make this PR less risky.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@SparkQA
Copy link

SparkQA commented Jul 31, 2020

Test build #126890 has finished for PR 29318 at commit 6cb0703.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@prakharjain09
Copy link
Contributor Author

@cloud-fan Thanks for the review. I have made the required changes.

@SparkQA
Copy link

SparkQA commented Aug 1, 2020

Test build #126918 has finished for PR 29318 at commit b1f8ba8.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Aug 1, 2020

Test build #126917 has finished for PR 29318 at commit f59fb49.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Aug 1, 2020

Test build #126920 has finished for PR 29318 at commit 9947c35.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor

thanks, merging to master/3.0!

@cloud-fan cloud-fan closed this in 7a09e71 Aug 3, 2020
cloud-fan pushed a commit that referenced this pull request Aug 3, 2020
### What changes were proposed in this pull request?
This PR fixes issues relate to Canonicalization of FileSourceScanExec when it contains unused DPP Filter.

### Why are the changes needed?

As part of PlanDynamicPruningFilter rule, the unused DPP Filter are simply replaced by `DynamicPruningExpression(TrueLiteral)` so that they can be avoided. But these unnecessary`DynamicPruningExpression(TrueLiteral)` partition filter inside the FileSourceScanExec affects the canonicalization of the node and so in many cases, this can prevent ReuseExchange from happening.

This PR fixes this issue by ignoring the unused DPP filter in the `def doCanonicalize` method.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Added UT.

Closes #29318 from prakharjain09/SPARK-32509_df_reuse.

Authored-by: Prakhar Jain <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
(cherry picked from commit 7a09e71)
Signed-off-by: Wenchen Fan <[email protected]>
@prakharjain09
Copy link
Contributor Author

@cloud-fan Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants