[SPARK-54593][SQL] Fix DPP eligibility for materialized filtering sides#56535
Draft
sunchao wants to merge 1 commit into
Draft
[SPARK-54593][SQL] Fix DPP eligibility for materialized filtering sides#56535sunchao wants to merge 1 commit into
sunchao wants to merge 1 commit into
Conversation
Co-authored-by: Tri Tam Hoang <tritam.hoang@gmail.com> Co-authored-by: Dustin Smith <Dustin.William.Smith@gmail.com>
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.
Why are the changes needed?
PR #56071 extended dynamic partition pruning (DPP) eligibility to filtering plans containing a
LocalRelationor a checkpoint-derivedLogicalRDD. However, a materialized leaf does not make every operator above it repeatable. If a derived filtering plan contains user code, a subquery, or another non-repeatable operator, DPP may evaluate it independently from the join or may bind to a matching sibling broadcast elsewhere in the physical plan. The two evaluations can then produce different pruning keys and incorrectly remove rows from the probe side.The checkpoint marker also records provenance rather than materialization state. A lazy checkpoint is therefore considered eligible before its first action has actually materialized and truncated the RDD lineage.
This is a follow-up to #56071. The materialized-input approach originated in #53263 (SPARK-54554) and was extended to
LocalRelationandLogicalRDDin #53324 (SPARK-54593). This follow-up credits @mc8max and @dwsmith1983 as co-authors, as requested in the attribution discussion on #56071.What changes were proposed in this PR?
LogicalRDDto be both provenance-marked and actually materialized according toRDD.isCheckpointed.Project,Filter,Union, andSubqueryAliasnodes, while rejecting subqueries, user-defined/non-SQL expressions, generators, and unknown logical operators.mapPartitions, scalar subqueries, standalone DPP, lazy checkpoint materialization, and the sibling-broadcast wrong-result shape with adaptive execution both disabled and enabled.This changes only behavior introduced on unreleased
master: unsafe derived materialized plans no longer receive DPP, while repeatable materialized plans retain the optimization.Generated-by: OpenAI Codex
How was this PR tested?
build/sbt 'sql/testOnly org.apache.spark.sql.DynamicPartitionPruningV1SuiteAEOff org.apache.spark.sql.DynamicPartitionPruningV1SuiteAEOn'(82 passed, 2 ignored)build/sbt 'sql/testOnly org.apache.spark.sql.DatasetSuite -- -z "Dataset.checkpoint() - basic"'(4 passed)build/sbt sql/scalastyle sql/Test/scalastyle(0 errors and 0 warnings)