Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,16 @@ public Map<String, String> loadNamespaceMetadata(Namespace namespace) {
}
}

@Override
protected boolean isValidIdentifier(TableIdentifier identifier) {
try {
validateNamespace(identifier.namespace());
} catch (IllegalArgumentException e) {
return false;
}
return true;
}

@Override
public String name() {
return catalogName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static org.apache.iceberg.CatalogUtil.ICEBERG_CATALOG_TYPE;
import static org.apache.iceberg.CatalogUtil.ICEBERG_CATALOG_TYPE_BIGQUERY;
import static org.apache.iceberg.gcp.bigquery.BigQueryMetastoreCatalog.PROJECT_ID;
import static org.assertj.core.api.Assertions.assertThat;

import java.io.File;
import java.util.List;
Expand Down Expand Up @@ -144,10 +145,6 @@ public void createTableTransaction(int formatVersion) {
@Test
public void testCreateTableWithDefaultColumnValue() {}

@Disabled("BigQuery Metastore does not support multi layer namespaces")
@Test
public void testLoadMetadataTable() {}

@Disabled("BigQuery Metastore does not support rename tables")
@Test
public void testRenameTable() {
Expand All @@ -171,4 +168,31 @@ public void renameTableNamespaceMissing() {
public void testRenameTableMissingSourceTable() {
super.testRenameTableMissingSourceTable();
}

@Test
public void testIsValidIdentifierWithValidSingleLevelNamespace() {
assertThat(catalog.isValidIdentifier(TableIdentifier.of("dataset1", "table1"))).isTrue();
}

@Test
public void testIsValidIdentifierWithInvalidMultiLevelNamespace() {
assertThat(
catalog.isValidIdentifier(
TableIdentifier.of(Namespace.of("level1", "level2"), "table1")))
.isFalse();
}

@Test
public void testIsValidIdentifierWithThreeLevelNamespace() {
assertThat(
catalog.isValidIdentifier(
TableIdentifier.of(Namespace.of("level1", "level2", "level3"), "table1")))
.isFalse();
}

@Test
public void testIsValidIdentifierWithEmptyNamespace() {
assertThat(catalog.isValidIdentifier(TableIdentifier.of(Namespace.empty(), "table1")))
.isFalse();
}
}