Skip to content

Commit

Permalink
[Enhancement] update iceberg cache default value (#41826)
Browse files Browse the repository at this point in the history
Signed-off-by: stephen <stephen5217@163.com>
(cherry picked from commit eba99a5)
  • Loading branch information
stephen-shelby authored and mergify[bot] committed Feb 29, 2024
1 parent 5477c62 commit 2c8d9df
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Expand Up @@ -111,8 +111,13 @@ public ConnectorMetadata getMetadata() {
public IcebergCatalog getNativeCatalog() {
if (icebergNativeCatalog == null) {
IcebergCatalog nativeCatalog = buildIcebergNativeCatalog();
boolean enableMetadataCache = Boolean.parseBoolean(
properties.getOrDefault("enable_iceberg_metadata_cache", "true"));
boolean enableMetadataCache;
if (properties.containsKey("enable_iceberg_metadata_cache")) {
enableMetadataCache = Boolean.parseBoolean(properties.get("enable_iceberg_metadata_cache"));
} else {
enableMetadataCache = getNativeCatalogType() == IcebergCatalogType.GLUE_CATALOG;
}

if (enableMetadataCache && !isResourceMappingCatalog(catalogName)) {
long ttl = Long.parseLong(properties.getOrDefault("iceberg_meta_cache_ttl_sec", "1800"));
nativeCatalog = new CachingIcebergCatalog(nativeCatalog, ttl, buildBackgroundJobPlanningExecutor());
Expand Down
4 changes: 2 additions & 2 deletions test/sql/test_iceberg/R/test_iceberg_catalog
@@ -1,5 +1,5 @@
-- name: testIcebergCatalog
create external catalog iceberg_sql_test_${uuid0} PROPERTIES ("type"="iceberg", "iceberg.catalog.type"="hive", "iceberg.catalog.hive.metastore.uris"="${iceberg_catalog_hive_metastore_uris}");
create external catalog iceberg_sql_test_${uuid0} PROPERTIES ("type"="iceberg", "iceberg.catalog.type"="hive", "iceberg.catalog.hive.metastore.uris"="${iceberg_catalog_hive_metastore_uris}", "enable_iceberg_metadata_cache"="true");
-- result:
-- !result
select * from iceberg_sql_test_${uuid0}.iceberg_oss_db.test_trans_part;
Expand All @@ -13,4 +13,4 @@ select * from iceberg_sql_test_${uuid0}.iceberg_oss_db.test_trans_part;
-- !result
drop catalog iceberg_sql_test_${uuid0}
-- result:
-- !result
-- !result
4 changes: 2 additions & 2 deletions test/sql/test_iceberg/T/test_iceberg_catalog
@@ -1,8 +1,8 @@
-- name: testIcebergCatalog

create external catalog iceberg_sql_test_${uuid0} PROPERTIES ("type"="iceberg", "iceberg.catalog.type"="hive", "iceberg.catalog.hive.metastore.uris"="${iceberg_catalog_hive_metastore_uris}");
create external catalog iceberg_sql_test_${uuid0} PROPERTIES ("type"="iceberg", "iceberg.catalog.type"="hive", "iceberg.catalog.hive.metastore.uris"="${iceberg_catalog_hive_metastore_uris}","enable_iceberg_metadata_cache"="true");

-- only partition column Predicate with runtime filter
select * from iceberg_sql_test_${uuid0}.iceberg_oss_db.test_trans_part;

drop catalog iceberg_sql_test_${uuid0}
drop catalog iceberg_sql_test_${uuid0}

0 comments on commit 2c8d9df

Please sign in to comment.