World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#3985] fix(hadooop-catalog): Create fileset catalog with empty location property success, but can't list schema of the catalog (#4177)
liuxian9be7cc999f97
diff --git a/catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/HadoopCatalogOperations.java b/catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/HadoopCatalogOperations.javaindex b82eaa3593..6b49c13102 100644--- a/catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/HadoopCatalogOperations.java+++ b/catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/HadoopCatalogOperations.java@@ -135,7 +135,10 @@ public class HadoopCatalogOperations implements CatalogOperations, SupportsSchemconf.forEach(hadoopConf::set);initAuthentication(conf, hadoopConf);- this.catalogStorageLocation = Optional.ofNullable(catalogLocation).map(Path::new);+ this.catalogStorageLocation =+ StringUtils.isNotBlank(catalogLocation)+ ? Optional.of(catalogLocation).map(Path::new)+ : Optional.empty();}private void initAuthentication(Map<String, String> conf, Configuration hadoopConf) {diff --git a/catalogs/catalog-hadoop/src/test/java/org/apache/gravitino/catalog/hadoop/TestHadoopCatalogOperations.java b/catalogs/catalog-hadoop/src/test/java/org/apache/gravitino/catalog/hadoop/TestHadoopCatalogOperations.javaindex 284070f0b0..3c8a4d463d 100644--- a/catalogs/catalog-hadoop/src/test/java/org/apache/gravitino/catalog/hadoop/TestHadoopCatalogOperations.java+++ b/catalogs/catalog-hadoop/src/test/java/org/apache/gravitino/catalog/hadoop/TestHadoopCatalogOperations.java@@ -230,6 +230,22 @@ public class TestHadoopCatalogOperations {Assertions.assertEquals("Schema m1.c1.schema11 already exists", exception.getMessage());}+ @Test+ public void testCreateSchemaWithEmptyCatalogLocation() throws IOException {+ String name = "schema28";+ String comment = "comment28";+ String catalogPath = "";+ Schema schema = createSchema(name, comment, catalogPath, null);+ Assertions.assertEquals(name, schema.name());+ Assertions.assertEquals(comment, schema.comment());++ Throwable exception =+ Assertions.assertThrows(+ SchemaAlreadyExistsException.class,+ () -> createSchema(name, comment, catalogPath, null));+ Assertions.assertEquals("Schema m1.c1.schema28 already exists", exception.getMessage());+ }+@Testpublic void testCreateSchemaWithCatalogLocation() throws IOException {String name = "schema12";