-
Notifications
You must be signed in to change notification settings - Fork 3k
Hive: Add table UUID to HMS table properties. #3914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
99b7555
bc1901a
a6c30c3
368f0cb
c734c24
b092d29
47fb910
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,6 @@ | |
| import java.util.Map; | ||
| import java.util.Optional; | ||
| import java.util.Set; | ||
| import java.util.UUID; | ||
| import java.util.stream.Collectors; | ||
| import java.util.stream.StreamSupport; | ||
| import org.apache.flink.table.api.DataTypes; | ||
|
|
@@ -179,10 +178,9 @@ public void testCreateTableIfNotExists() { | |
| sql("CREATE TABLE IF NOT EXISTS tl(id BIGINT)"); | ||
| Assert.assertEquals(Maps.newHashMap(), table("tl").properties()); | ||
|
|
||
| final String uuid = UUID.randomUUID().toString(); | ||
| final Map<String, String> expectedProperties = ImmutableMap.of("uuid", uuid); | ||
| final Map<String, String> expectedProperties = ImmutableMap.of("key", "value"); | ||
| table("tl").updateProperties() | ||
| .set("uuid", uuid) | ||
| .set("key", "value") | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we make the same change for the same test in v1.12 and v1.13?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The CI said yes :-( . Made the change. |
||
| .commit(); | ||
| Assert.assertEquals(expectedProperties, table("tl").properties()); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -624,7 +624,7 @@ public void testIcebergAndHmsTableProperties() throws Exception { | |
| Assert.assertEquals(expectedIcebergProperties, icebergTable.properties()); | ||
|
|
||
| if (Catalogs.hiveCatalog(shell.getHiveConf(), tableProperties)) { | ||
| Assert.assertEquals(10, hmsParams.size()); | ||
| Assert.assertEquals(11, hmsParams.size()); | ||
| Assert.assertEquals("initial_val", hmsParams.get("custom_property")); | ||
| Assert.assertEquals("TRUE", hmsParams.get(InputFormatConfig.EXTERNAL_TABLE_PURGE)); | ||
| Assert.assertEquals("TRUE", hmsParams.get("EXTERNAL")); | ||
|
|
@@ -662,7 +662,7 @@ public void testIcebergAndHmsTableProperties() throws Exception { | |
| .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); | ||
|
|
||
| if (Catalogs.hiveCatalog(shell.getHiveConf(), tableProperties)) { | ||
| Assert.assertEquals(13, hmsParams.size()); // 2 newly-added properties + previous_metadata_location prop | ||
| Assert.assertEquals(14, hmsParams.size()); // 2 newly-added properties + previous_metadata_location prop | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Could we convert 14 -> an expression that calculates the expected number of properties rather than having to manually change this whenever we add new properties?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It makes sense to avoid magic number. Here, I'd just leave it as is. Adding a reserved table property doesn't happen frequently. I'd avoid a smart solution to calculate the property number, which add complexity to the unit test. But I'm also open to any nice solution. |
||
| Assert.assertEquals("true", hmsParams.get("new_prop_1")); | ||
| Assert.assertEquals("false", hmsParams.get("new_prop_2")); | ||
| Assert.assertEquals("new_val", hmsParams.get("custom_property")); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you might need to add the new constant
UUIDto this set of reserved properties just below this line.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. We should NOT allow user to add a uuid as a table property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add a test for that.