From 0fa28f18d5247591b42667d02e9d6dec7edf2f5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BF=9C=E6=85=95?= Date: Wed, 23 Oct 2024 17:08:28 +0800 Subject: [PATCH] [hive]add retention seconds in hive catalog. --- .../src/main/java/org/apache/paimon/hive/HiveCatalog.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java index 4d9c482a20da..b92940c54e55 100644 --- a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java +++ b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java @@ -814,6 +814,12 @@ private Table newHmsTable( if (provider == null) { provider = "paimon"; } + CoreOptions coreOptions = CoreOptions.fromMap(tableParameters); + java.time.Duration partitionExpireTime = coreOptions.partitionExpireTime(); + int retention = Integer.MAX_VALUE; + if (partitionExpireTime != null && partitionExpireTime.getSeconds() <= Integer.MAX_VALUE) { + retention = (int) partitionExpireTime.getSeconds(); + } Table table = new Table( identifier.getTableName(), @@ -822,7 +828,7 @@ private Table newHmsTable( System.getProperty("user.name"), (int) (currentTimeMillis / 1000), (int) (currentTimeMillis / 1000), - Integer.MAX_VALUE, + retention, null, Collections.emptyList(), tableParameters,