-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-45592][SQL] Correctness issue in AQE with InMemoryTableScanExec #43435
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
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
17a3758
SPARK-45592: AQE correctness issue
f05366d
Revert sloppy fix
cebba4c
Implement CoalescedHashPartitioning
3ea57d8
Clean up CoalescedHPSpec should not create partitioning
408cb92
Fix WriteDistributionAndOrderingSuit
4f6bd1d
More PR comments
7402821
More review comments
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -306,6 +306,35 @@ case class HashPartitioning(expressions: Seq[Expression], numPartitions: Int) | |
|
|
||
| override protected def withNewChildrenInternal( | ||
| newChildren: IndexedSeq[Expression]): HashPartitioning = copy(expressions = newChildren) | ||
|
|
||
| } | ||
|
|
||
| case class CoalescedBoundary(startReducerIndex: Int, endReducerIndex: Int) | ||
|
|
||
| /** | ||
| * Represents a partitioning where partitions have been coalesced from a HashPartitioning into a | ||
| * fewer number of partitions. | ||
| */ | ||
| case class CoalescedHashPartitioning(from: HashPartitioning, partitions: Seq[CoalescedBoundary]) | ||
eejbyfeldt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| extends Expression with Partitioning with Unevaluable { | ||
|
|
||
| override def children: Seq[Expression] = from.expressions | ||
| override def nullable: Boolean = from.nullable | ||
| override def dataType: DataType = from.dataType | ||
|
|
||
| override def satisfies0(required: Distribution): Boolean = from.satisfies0(required) | ||
|
|
||
| override def createShuffleSpec(distribution: ClusteredDistribution): ShuffleSpec = | ||
| CoalescedHashShuffleSpec(from.createShuffleSpec(distribution), partitions) | ||
|
|
||
| override protected def withNewChildrenInternal( | ||
| newChildren: IndexedSeq[Expression]): CoalescedHashPartitioning = | ||
| copy(from = from.copy(expressions = newChildren)) | ||
|
|
||
| override val numPartitions: Int = partitions.length | ||
|
|
||
| override def toString: String = from.toString | ||
| override def sql: String = from.sql | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After a second thought, why do we need to hide |
||
| } | ||
|
|
||
| /** | ||
|
|
@@ -708,6 +737,26 @@ case class HashShuffleSpec( | |
| override def numPartitions: Int = partitioning.numPartitions | ||
| } | ||
|
|
||
| case class CoalescedHashShuffleSpec( | ||
| from: ShuffleSpec, | ||
| partitions: Seq[CoalescedBoundary]) extends ShuffleSpec { | ||
|
|
||
| override def isCompatibleWith(other: ShuffleSpec): Boolean = other match { | ||
| case SinglePartitionShuffleSpec => | ||
| numPartitions == 1 | ||
| case CoalescedHashShuffleSpec(otherParent, otherPartitions) => | ||
| partitions == otherPartitions && from.isCompatibleWith(otherParent) | ||
| case ShuffleSpecCollection(specs) => | ||
| specs.exists(isCompatibleWith) | ||
| case _ => | ||
| false | ||
| } | ||
|
|
||
| override def canCreatePartitioning: Boolean = false | ||
|
|
||
| override def numPartitions: Int = partitions.length | ||
| } | ||
|
|
||
| /** | ||
| * [[ShuffleSpec]] created by [[KeyGroupedPartitioning]]. | ||
| * | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.