Updated on 2026-08-29 GMT+08:00

Changing the Number of Buckets

Notes and Constraints

This section applies only to MRS 3.6.0-LTS.1 and later.

Function

If a Hudi table uses an inappropriate number of buckets due to significant changes in data volume, and you cannot rebuild the table, use this command to adjust the bucket count for a specific partition.

Syntax

View the number of buckets in a specified partition.

call show_bucket_num(table => '${tableName}', partition => '${partitionPath}')

Change the number of buckets for a specific partition.

call change_bucket_num(table => '${tableName}', partition => '${partitionPath}', bucketNum => '${newBucketNumber }')

Parameter Description

Parameter

Description

Mandatory

tableName

Hudi table name. Database name.Table name is also supported. The value is a string.

Yes

partitionPath

Partition path. The value is a string.

  1. The partition path is optional. If no path is specified, the command changes the bucket count for the entire table. Additionally, all new partitions will be created using this updated bucket count.
  2. If a partition is specified, the command only changes the bucket count for that specific partition. However, if that partition is deleted and later recreated, the custom bucket count is lost. The new partition will revert to the default bucket count configured in the table index.
  3. For multi-level partitions, use the following format: par1=xxx/par2=yyy/par3=xxx.

No

newBucketNumber

New bucket number. The value is an integer.

HetuEngine does not support primary key-based equality queries on Hudi tables that have modified bucket counts.

Yes

Example

View the number of buckets in a specified partition.

call show_bucket_num(table => 'hudi_table', partition => 'par=1')

Change the number of buckets for a specific partition.

call change_bucket_num(table => "hudi_table", partition => 'par=1', bucketNum => '3')