Package org.apache.beam.sdk.io.iceberg
Class TableCache
java.lang.Object
org.apache.beam.sdk.io.iceberg.TableCache
Process-wide cache for Iceberg
Tables.
Entries are keyed by catalog configuration and table identifier, so one machine can share
table metadata across source and sink threads without colliding when different catalogs contain
the same identifier. The underlying catalog is only resolved from IcebergCatalogConfig
when the table has to be loaded. Refreshes are synchronized per table entry: if another thread
refreshed after a caller started its request, the caller reuses that refresh instead of making
another catalog call.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.iceberg.Tableget(IcebergCatalogConfig catalogConfig, String identifier) Returns the cached table for a string identifier, loading it on a cache miss.static org.apache.iceberg.Tableget(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier) Returns the cached table, loading it from the catalog on a cache miss.static org.apache.iceberg.Tableget(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier, Callable<org.apache.iceberg.Table> loader) Returns the cached table, using the given loader only on a cache miss.static org.apache.iceberg.TablegetAndRefreshIfStale(IcebergCatalogConfig catalogConfig, String identifier) static org.apache.iceberg.TablegetAndRefreshIfStale(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier) Returns the cached table, refreshing it only if it is older thanDEFAULT_REFRESH_INTERVAL.static org.apache.iceberg.TablegetAndRefreshIfStale(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier, Callable<org.apache.iceberg.Table> loader) Returns the cached table, using the loader on a miss and refreshing stale entries.static org.apache.iceberg.TablegetRefreshed(IcebergCatalogConfig catalogConfig, String identifier) Returns the cached table for a string identifier after refreshing any pre-existing entry.static org.apache.iceberg.TablegetRefreshed(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier) Returns the cached table after forcing a refresh of any pre-existing cache entry.
-
Constructor Details
-
TableCache
public TableCache()
-
-
Method Details
-
get
public static org.apache.iceberg.Table get(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier) Returns the cached table, loading it from the catalog on a cache miss. -
get
Returns the cached table for a string identifier, loading it on a cache miss. -
get
public static org.apache.iceberg.Table get(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier, Callable<org.apache.iceberg.Table> loader) Returns the cached table, using the given loader only on a cache miss. -
getRefreshed
public static org.apache.iceberg.Table getRefreshed(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier) Returns the cached table after forcing a refresh of any pre-existing cache entry. -
getRefreshed
public static org.apache.iceberg.Table getRefreshed(IcebergCatalogConfig catalogConfig, String identifier) Returns the cached table for a string identifier after refreshing any pre-existing entry. -
getAndRefreshIfStale
public static org.apache.iceberg.Table getAndRefreshIfStale(IcebergCatalogConfig catalogConfig, String identifier) -
getAndRefreshIfStale
public static org.apache.iceberg.Table getAndRefreshIfStale(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier) Returns the cached table, refreshing it only if it is older thanDEFAULT_REFRESH_INTERVAL. -
getAndRefreshIfStale
public static org.apache.iceberg.Table getAndRefreshIfStale(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier, Callable<org.apache.iceberg.Table> loader) Returns the cached table, using the loader on a miss and refreshing stale entries.
-