Updated on 2024-05-29 GMT+08:00

Compaction

This section applies only to MRS 3.3.0 or later.

Function

Compacts Hudi tables. For details, see Compaction.

Syntax

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

Parameter Description

Table 1 Parameters

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.

No

path

Path of the table to be queried

No

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 => '/user/hive/warehouse/hudi_table1', op => 'run', timestamp => 'xxx');

Precautions

Only MOR tables can be compacted.

System Response

You can view query results on the client.