Skip to content

Commit

Permalink
[#3985] fix(hadooop-catalog): Create fileset catalog with empty locat…
Browse files Browse the repository at this point in the history
…ion property success, but can't list schema of the catalog (#4177)

### What changes were proposed in this pull request?

Check if the catalogLocation is empty when initializing

### Why are the changes needed?

Fix: #3985 

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

Existing pipeline.

Before
<img width="1480" alt="image"
src="https://github.com/user-attachments/assets/42003bf4-f6a2-4729-98fc-bf139a811daf">

After
<img width="865" alt="image"
src="https://github.com/user-attachments/assets/531dbc3b-7ad3-4949-8910-ea99bb31baa1">
  • Loading branch information
Leonidas963 authored Jul 18, 2024
1 parent 80cc26a commit 9be7cc9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ public void initialize(
conf.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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,22 @@ public void testCreateSchemaWithNoLocation() throws IOException {
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());
}

@Test
public void testCreateSchemaWithCatalogLocation() throws IOException {
String name = "schema12";
Expand Down

0 comments on commit 9be7cc9

Please sign in to comment.