rdblue commented on code in PR #11369:
URL: https://github.com/apache/iceberg/pull/11369#discussion_r1925938262


##########
core/src/main/java/org/apache/iceberg/ContentFileParser.java:
##########
@@ -48,6 +48,97 @@ class ContentFileParser {
 
   private ContentFileParser() {}
 
+  public static void unboundContentFileToJson(
+      ContentFile<?> contentFile, PartitionSpec spec, JsonGenerator generator) 
throws IOException {
+    Preconditions.checkArgument(contentFile != null, "Invalid content file: 
null");
+    Preconditions.checkArgument(spec != null, "Invalid partition spec: null");
+    Preconditions.checkArgument(generator != null, "Invalid JSON generator: 
null");
+    Preconditions.checkArgument(
+        contentFile.specId() == spec.specId(),
+        "Invalid partition spec id from content file: expected = %s, actual = 
%s",
+        spec.specId(),
+        contentFile.specId());
+
+    generator.writeStartObject();
+    // ignore the ordinal position (ContentFile#pos) of the file in a manifest,
+    // as it isn't used and BaseFile constructor doesn't support it.

Review Comment:
   I think it is okay since it is pre-existing. It's also good context since 
the position isn't in the spec and is used to help streaming readers keep 
incremental state.



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

Reply via email to