Updated on 2024-10-09 GMT+08:00

COMPACTION

This topic is available for MRS 3.3.0 or later only.

Function

Compacts Hudi tables. For details, see Hudi Compaction.

Syntax

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

Parameters

Table 1 Parameter description

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.

Response

You can view query results on the client.