zghong opened a new issue, #66231: URL: https://github.com/apache/doris/issues/66231
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no similar issues. ### Version master / 4.0.5 ### What's Wrong? We have a table with 484,862,245,170 rows, and the data is evenly divided according to `shard_num`. ```sql CREATE TABLE user_label_double_v1 ( `shard_num` SMALLINT NOT NULL `label_name` VARCHAR(64) NOT NULL `label_value` DOUBLE NOT NULL `uid` INT NOT NULL `dt` Date NOT NULL ) DUPLICATE KEY(shard_num, label_name) AUTO PARTITION BY RANGE (date_trunc(`dt`, 'day')) () DISTRIBUTED BY HASH(shard_num) BUCKETS 512 PROPERTIES ( "replication_num" = "3", "compression" = "zstd" ); ``` Define `DISTRIBUTED BY HASH(shard_num) BUCKETS 512` of the table in Doris, but we found there are some empty tablets after importing all data. ```sql Doris [email protected]:datamill_test2> select shard_num, count() from user_label_double_v1 group by shard_num order by shard_num; +-----------+-----------+ | shard_num | count(*) | +-----------+-----------+ | 0 | 947087198 | | 1 | 947550670 | | 2 | 947106194 | -- ... | 510 | 947408237 | | 511 | 946735634 | +-----------+-----------+ 512 rows in set Time: 46.628s ``` <img width="1222" height="1207" alt="Image" src="https://github.com/user-attachments/assets/d0dae96b-30e7-4bee-a73b-50816e305a8a" /> ### What You Expected? Each data bucket is evenly distributed. ### How to Reproduce? _No response_ ### Anything Else? When defining Hash Bucketing, we want to specify a custom hash function instead of using the fixed `CRC32`. For example, we can use `crc32(col) % bucket_num`, or use `xxhash64(col) % bucket_num`, or even `col % bucket_num`. ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
