Updated on 2024-12-13 GMT+08:00

Initializing the Partitions of Inventory Tables

Function

Calculate the last modification time of each historical partition and write the time to the .hoodie_partition_metadata file in each partition in the format of lastUpdateTime=Last modification time. TTL determines whether a partition is aged based on the result of Current system time – Last modification time of the partition.

Syntax

call ttl_update_partitions(table => "[table]", path => "[path]", dryRun => [dryRun])
  • If dryRun is true, the last modification time of each partition is printed, but is not written to the .hoodie_partition_metadata file.
  • When dryRun is false, the last modification time of each partition is printed and written to the .hoodie_partition_metadata file.

Description

Parameter

Description

Mandatory

table

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

No. Specify either table or path.

path

Absolute path of the table. The value is a string.

No. Specify either table or path.

dryRun

The value is of the Boolean type.

The value can be false or true. The default value is false.

Examples

Initialize TTL by specifying a table name.

call ttl_update_partitions(table => "hudi_table", dryRun => true)

Initialize TTL by specifying a path.

call ttl_update_partitions(path => "hdfs://hacluster/user/hive/warehouse/hudi_table/", dryRun => true)