apache / paimon

Apache Paimon is a lake format that enables building a Realtime Lakehouse Architecture with Flink and Spark for both streaming and batch operations.
https://paimon.apache.org/
Apache License 2.0
2.35k stars 928 forks source link

[Bug] spark fixed bucket write causes task data process unevenly for pk table #3651

Open askwang opened 3 months ago

askwang commented 3 months ago

Search before asking

Paimon version

0.8

Compute Engine

spark

Minimal reproduce step

When we use fixed bucket to write data for pk table, we set 1000 buckets, and want to process data with 1000 partitions evenly. But we found some tasks process no data and some tasks process many data. This will cause the overall running time of the task to be longer.

We found the root cause is repartitionByExpression will perform hash calculation again based on the bucket column. That will result in uneven distribution of partitions.

Some our configs:

primary-key = uuid
bucket = 1000
spark.sql.shuffle.partitions=1000

image

What doesn't meet your expectations?

partitions data distribution.

Anything else?

No response

Are you willing to submit a PR?