diff --git a/.gitignore b/.gitignore index 2c65563799..1e9363dcac 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,4 @@ conf/ *unit_test_base_tmp/ */.gitignore +local/conf/ diff --git a/ams/api/src/main/java/com/netease/arctic/ams/api/properties/CatalogMetaProperties.java b/ams/api/src/main/java/com/netease/arctic/ams/api/properties/CatalogMetaProperties.java index ae18ba8783..4c3c69d59a 100644 --- a/ams/api/src/main/java/com/netease/arctic/ams/api/properties/CatalogMetaProperties.java +++ b/ams/api/src/main/java/com/netease/arctic/ams/api/properties/CatalogMetaProperties.java @@ -42,6 +42,7 @@ public class CatalogMetaProperties { public static final String KEY_WAREHOUSE_DIR = "warehouse.dir"; public static final String KEY_WAREHOUSE = "warehouse"; public static final String KEY_DATABASE_FILTER_REGULAR_EXPRESSION = "database.filter-regular-expression"; + public static final String KEY_TABLE_FILTER_REGULAR_EXPRESSION = "table.filter-regular-expression"; public static final String CATALOG_TYPE_HADOOP = "hadoop"; public static final String CATALOG_TYPE_HIVE = "hive"; diff --git a/core/src/main/java/com/netease/arctic/catalog/IcebergCatalogWrapper.java b/core/src/main/java/com/netease/arctic/catalog/IcebergCatalogWrapper.java index 78a3a45554..c8bdd0ca2b 100644 --- a/core/src/main/java/com/netease/arctic/catalog/IcebergCatalogWrapper.java +++ b/core/src/main/java/com/netease/arctic/catalog/IcebergCatalogWrapper.java @@ -57,6 +57,7 @@ public class IcebergCatalogWrapper implements ArcticCatalog { private CatalogMeta meta; private Map customProperties; private Pattern databaseFilterPattern; + private Pattern tableFilterPattern; private transient TableMetaStore tableMetaStore; private transient Catalog icebergCatalog; @@ -90,6 +91,15 @@ private void initialize(CatalogMeta meta, Map properties) { } else { databaseFilterPattern = null; } + + if (meta.getCatalogProperties().containsKey(CatalogMetaProperties.KEY_TABLE_FILTER_REGULAR_EXPRESSION)) { + String tableFilter = + meta.getCatalogProperties().get(CatalogMetaProperties.KEY_TABLE_FILTER_REGULAR_EXPRESSION); + tableFilterPattern = Pattern.compile(tableFilter); + } else { + tableFilterPattern = null; + } + } public IcebergCatalogWrapper(CatalogMeta meta, Map properties) { @@ -148,9 +158,10 @@ public void dropDatabase(String databaseName) { @Override public List listTables(String database) { return tableMetaStore.doAs(() -> icebergCatalog.listTables(Namespace.of(database)).stream() - .filter(tableIdentifier -> tableIdentifier.namespace().levels().length == 1) - .map(tableIdentifier -> TableIdentifier.of(name(), database, tableIdentifier.name())) - .collect(Collectors.toList())); + .filter(tableIdentifier -> tableIdentifier.namespace().levels().length == 1 + && (tableFilterPattern == null || tableFilterPattern.matcher(tableIdentifier.name()).matches())) + .map(tableIdentifier -> TableIdentifier.of(name(), database, tableIdentifier.name())) + .collect(Collectors.toList())); } public List listTables() {