Updated on 2025-02-22 GMT+08:00

COMPACTION

Function

Compacts Hudi tables. For details, see Hudi Compaction.

Syntax

call run_compaction(op => '[op]', table=>'[table]', path=>'[path]', timestamp=>'[timestamp]');

Parameter Description

Table 1 Parameter descriptions

Parameter

Description

Mandatory

op

Set this parameter to schedule to generate a compaction plan or to run to execute a generated compaction plan.

Yes

table

Name of the table to be queried. The value can be in the database.tablename format.

Either table or path must be set.

path

Path of the table to be queried

Either table or path must be set.

timestamp

When op is set to run, you can specify timestamp to execute the compaction plan corresponding to the timestamp and the compaction plan that is not executed before the timestamp.

No

Example

call run_compaction(table => 'hudi_table1', op => 'schedule');
call run_compaction(table => 'hudi_table1', op => 'run');
call run_compaction(table => 'hudi_table1', op => 'run', timestamp => 'xxx');
call run_compaction(path => 'obs://bucket/path/hudi_table1', op => 'run', timestamp => 'xxx');

Caveats

Only MOR tables can be compacted.

System Response

You can check if the job status is successful, view the job result, and review the job logs to confirm if there are any exceptions.