amogh-jahagirdar commented on code in PR #9310:
URL: https://github.com/apache/iceberg/pull/9310#discussion_r1428865937
##########
core/src/main/java/org/apache/iceberg/BaseMetadataTable.java:
##########
@@ -202,7 +204,7 @@ public Map<String, SnapshotRef> refs() {
@Override
public UUID uuid() {
- return UUID.randomUUID();
Review Comment:
Wow, I can't believe I wrote it like this originally :). Good fix, yes we do
want a UUID but it should be consistent across the same Metadata Table.
The only thing is if we extend this logic further is that the same base
metadata table across different references won't return the same UUID. So for
example "all manifests" for t1 may have a different UUID than "all manifests"
for t1 in a different query.
I don't really see a way around that without persisting the UUID somewhere
but considering metadata tables are really more logical tables, I think that's
OK. If we wanted that strict definition for metadata tables, then we would have
to throw an unsupported until we persisted those details somewhere.
For now though, I think this change is good as is.
##########
core/src/test/java/org/apache/iceberg/TestMetadataTableScans.java:
##########
@@ -138,6 +139,18 @@ public void testManifestsTableAlwaysIgnoresResiduals()
throws IOException {
}
}
+ @Test
+ public void testManifestsTableUUID() {
+ Table manifestsTable = new ManifestsTable(table);
+
+ Assertions.assertThat(manifestsTable.uuid())
+ .as("UUID should be consistent on multiple calls")
+ .isEqualTo(manifestsTable.uuid());
+ Assertions.assertThat(manifestsTable.uuid())
+ .as("Metadata table UUID should be different from main table UUID")
Review Comment:
Nit: "should be different from the base table's UUID"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]