fengruotj opened a new issue, #11412: URL: https://github.com/apache/paimon/issues/11412
### Search before asking - [x] I searched in the [issues](https://github.com/apache/paimon/issues) and found nothing similar. ### Motivation When Spark writes to a fixed-bucket Paimon table, it shuffles rows by table partition and bucket before writing. Spark chooses the number of shuffle partitions, and Adaptive Query Execution (AQE) may coalesce them. As a result, a small input batch that touches many buckets can leave only a few tasks to do the writing. ### Solution Support the optional `sink.parallelism` setting for Spark writes to tables in `HASH_FIXED` bucket mode. A positive value sets the number of partitions in the final write shuffle for both the V1 and V2 write paths. When the option is unset, zero, or negative, Spark continues to choose the parallelism. Users can set the option on a table: ```sql CREATE TABLE events (id INT) USING paimon TBLPROPERTIES ( 'primary-key' = 'id', 'bucket' = '16', 'sink.parallelism' = '7' ); INSERT INTO events SELECT CAST(id AS INT) FROM range(0, 40, 1, 4); ``` Users can also configure a session default with `SET spark.paimon.sink.parallelism=7`. ### Anything else? With AQE enabled on Spark 3.5.9, the example above used 4 input tasks and 7 write tasks. The table retained its 16 buckets, and all 40 rows were read back successfully. ### Are you willing to submit a PR? - [x] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
