RussellSpitzer commented on code in PR #12335: URL: https://github.com/apache/iceberg/pull/12335#discussion_r1961971576
########## core/src/main/java/org/apache/iceberg/TableMetadataParser.java: ########## @@ -216,9 +216,15 @@ public static void toJson(TableMetadata metadata, JsonGenerator generator) throw // write properties map JsonUtil.writeStringMap(PROPERTIES, metadata.properties(), generator); - generator.writeNumberField( - CURRENT_SNAPSHOT_ID, - metadata.currentSnapshot() != null ? metadata.currentSnapshot().snapshotId() : -1); + if (metadata.currentSnapshot() != null) { + generator.writeNumberField(CURRENT_SNAPSHOT_ID, metadata.currentSnapshot().snapshotId()); + } else { + if (metadata.formatVersion() >= 3) { Review Comment: I'd prefer we tie this to a constant, MIN_NULL_CURRENT_SNAPSHOT_VERSION or something like that. I just want to have all of these tweaks in one place so we can see all the behavior changes in a constant list. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org