79663229

Date: 2025-06-12 09:15:34
Score: 0.5
Natty:
Report link

Work out!

if you want make the ttl right for old partitions, just run this code :

USER paimon;

CALL sys.expire_partitions(
    table => 'paimon.dwd.dwd_paimon_trade_product', 
    expiration_time => '30 d', 
    timestamp_formatter => 'yyyy-MM-dd', 
    timestamp_pattern => '$dt', 
    expire_strategy => 'values-time'
);

when you create new table and write data into paimon table, you should set those properties:

) PARTITIONED BY (dt) TBLPROPERTIES (
    'primary-key' = 'dt,mall_id,order_id,pro_id',
    'bucket' = '32',
    'bucket-key' = 'order_id',
    'partition.expiration-time' = '30 d',
    'partition.expiration-check-interval' = '1 d',
    'partition.timestamp-formatter' = 'yyyy-MM-dd'
)
;

and if you want add ttl for a table of exist, you should run :

ALTER TABLE DB.t SET PROPERTIES (
    'partition.expiration-time' = '30 d',
    'partition.expiration-check-interval' = '1 d',
    'partition.timestamp-formatter' = 'yyyy-MM-dd'
);
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: dasen