Search before asking
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.
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.
Doris root@6.94.183.233: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
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?
Code of Conduct
Search before asking
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.Define
DISTRIBUTED BY HASH(shard_num) BUCKETS 512of the table in Doris, but we found there are some empty tablets after importing all data.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 usexxhash64(col) % bucket_num, or evencol % bucket_num.Are you willing to submit PR?
Code of Conduct