kbendick commented on code in PR #4716:
URL: https://github.com/apache/iceberg/pull/4716#discussion_r875233285


##########
core/src/main/java/org/apache/iceberg/MetadataUpdateParser.java:
##########
@@ -234,6 +290,58 @@ private static void 
writeAddSortOrder(MetadataUpdate.AddSortOrder update, JsonGe
     SortOrderParser.toJson(update.sortOrder(), gen);
   }
 
+  private static void 
writeSetDefaultSortOrder(MetadataUpdate.SetDefaultSortOrder update, 
JsonGenerator gen)
+      throws IOException {
+    gen.writeNumberField(SORT_ORDER_ID, update.sortOrderId());
+  }
+
+  private static void writeAddSnapshot(MetadataUpdate.AddSnapshot update, 
JsonGenerator gen) throws IOException {
+    gen.writeFieldName(SNAPSHOT);
+    SnapshotParser.toJson(update.snapshot(), gen);
+  }
+
+  // TODO - Reconcile the spec's set-based removal with the current class 
implementation that only handles one value.
+  private static void writeRemoveSnapshots(MetadataUpdate.RemoveSnapshot 
update, JsonGenerator gen) throws IOException {
+    gen.writeArrayFieldStart(SNAPSHOT_IDS);
+    for (long snapshotId : ImmutableSet.of(update.snapshotId())) {
+      gen.writeNumber(snapshotId);
+    }
+    gen.writeEndArray();
+  }
+
+  private static void writeSetSnapshotRef(MetadataUpdate.SetSnapshotRef 
update, JsonGenerator gen) throws IOException {
+    gen.writeStringField(REF_NAME, update.name());
+    gen.writeNumberField(SNAPSHOT_ID, update.snapshotId());
+    gen.writeStringField(TYPE, update.type());
+    // TODO - Should we explicitly set the null values?
+    JsonUtil.writeIntegerFieldIf(update.minSnapshotsToKeep() != null,
+        MIN_SNAPSHOTS_TO_KEEP, update.minSnapshotsToKeep(), gen);
+    JsonUtil.writeLongFieldIf(update.maxSnapshotAgeMs() != null,
+        MAX_SNAPSHOT_AGE_MS, update.maxSnapshotAgeMs(), gen);
+    JsonUtil.writeLongFieldIf(update.maxRefAgeMs() != null, MAX_REF_AGE_MS,
+        update.maxRefAgeMs(), gen);

Review Comment:
   Question: Should we explicitly set the `null` values or not?



-- 
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]

Reply via email to