Repository navigation
Hive : Fixing the trailing slash issue for the database paths in HMS - #14295
Conversation
singhpk234
left a comment
There was a problem hiding this comment.
LGTM, Thanks @Rajeev-01 !
|
Thanks @singhpk234 for the approval. All checks are green, can you or someone please merge it |
kevinjqliu
left a comment
There was a problem hiding this comment.
LGTM
Another potential issue is when setting the "location" value:
iceberg/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Lines 772 to 773 in 77bc1d0
I originally thought this was an issue, but its fine since databaseLocation takes care of the trailing slash:
iceberg/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Lines 725 to 727 in 77bc1d0
|
@Rajeev-01 Thanks for the PR. The fix looks good, but seems the test passes without the fix? |
Hey yeah @huaxingao thanks for pointing it out, I should have tested it without the fix 😓. The reason for test is not working was the HMS createDatabase call is internally using the org.apache.hadoop.fs.Path for creating the path which normalizes the path by removing the trailing slashes. This will work with hadoop >= 3.x since the fix landed in this version https://issues.apache.org/jira/browse/HADOOP-16226. |
|
The only way to make it work is by mocking but it's better not to introduce mock in e2e tests. |
|
@Rajeev-01 Thanks for checking this out! Since this is a simple fix, I’m okay merging without a mocked test. I think we can keep the current test as a smoke check (or drop it if others prefer). |
|
cool thanks @huaxingao |
| // Verify table location doesn't have double slashes | ||
| assertThat(table.location()) | ||
| .as("Table location should not contain multiple slashes") | ||
| .doesNotContain("//test_table") |
There was a problem hiding this comment.
nit: We could use doesNotEndWith method instead.
| catalog.dropTable(tableInDbWithSlash); | ||
| } finally { | ||
| // Dropping the test database | ||
| HIVE_METASTORE_EXTENSION.metastoreClient().dropDatabase(dbName); |
There was a problem hiding this comment.
nit: This line can show "Database xxx is not empty" message instead of the failed reason if the above assertion at L126 fails for some reason. We could enable cascade parameter for dropDatabase method.
|
Thanks for the fix @Rajeev-01 and thanks everyone for the review. |
|
@Rajeev-01 Hi 👋 Does this MR solve this issue? #15908 |
Hey yeah @aalopatin it solves double slash issue for HMS catalog, I thought of this will go in next release 😅 |
|
this has been backported to the 1.10.x (#16010) and will be included when we release 1.10.2 soon |
Summary
Test plan