[Feature] Reduce redundant shuffle for spark dynamic bucket writes
- Dominant language
- Java
- Stars
- 3.4k
- Forks
- 1.4k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 396
Description
### Search before asking
- [X] I searched in the [issues](https://github.com/apache/paimon/issues) and found nothing similar.
### Motivation
Dynamic bucket writing does two shuffles, the first `repartitionByKeyPartitionHash` seems unnecessary, It seems to be only used to determine `assignId`. However, `assignId` can be calculated through `partitionHash/keyHash/numParallelism/numAssigners`, we do not need to do extra shuffle. Can we remove it?
https://github.com/apache/paimon/blob/e27ceb464244f5a0c2bfa2a7c6db649ca945212b/paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/commands/PaimonSparkWriter.scala#L143
### Solution
_No response_
### Anything else?
_No response_
### Are you willing to submit a PR?
- [x] I'm willing to submit a PR!
Contributor guide
No contributing guide indexed for this repository
Research direction
Read paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/commands/PaimonSparkWriter.scala around line 143, then trace dynamic bucket writing and how assignId is derived. Confirm that the proposed partitionHash/keyHash/numParallelism/numAssigners calculation preserves bucket assignment, and that the first repartitionByKeyPartitionHash can be removed without changing write behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala, spark
- Domain
- data-engineering, distributed-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100