From 6b627a1f2dee9f478ba45d60aac8a2fcafbf704c Mon Sep 17 00:00:00 2001 From: Laszlo Bodor Date: Sun, 22 Jun 2025 19:40:12 +0200 Subject: [PATCH] HIVE-28793: Set default expiry time for query history snapshots --- .../hive/ql/queryhistory/repository/IcebergRepository.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ql/src/java/org/apache/hadoop/hive/ql/queryhistory/repository/IcebergRepository.java b/ql/src/java/org/apache/hadoop/hive/ql/queryhistory/repository/IcebergRepository.java index 38a57768f6ae..21cc6643bb58 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/queryhistory/repository/IcebergRepository.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/queryhistory/repository/IcebergRepository.java @@ -89,6 +89,9 @@ protected Table createTable(Hive hive, Database db) throws HiveException { ICEBERG_STORAGE_HANDLER); table.setProperty("table_type", "ICEBERG"); table.setProperty("write.format.default", "orc"); + // set the default max snapshot age to 1 day for query history + // this is applied only during table creation, it can be manually altered afterward. + table.setProperty("history.expire.max-snapshot-age-ms", Integer.toString(24 * 60 * 60 * 1000)); table.setProperty(hive_metastoreConstants.META_TABLE_NAME, QUERY_HISTORY_DB_TABLE_NAME); table.setFields(schema.getFields());