nastra commented on code in PR #7978:
URL: https://github.com/apache/iceberg/pull/7978#discussion_r1252578426


##########
flink/v1.17/flink/src/main/java/org/apache/iceberg/flink/source/split/IcebergSourceSplit.java:
##########
@@ -120,4 +131,56 @@ static IcebergSourceSplit deserializeV1(byte[] serialized) 
throws IOException {
       throw new RuntimeException("Failed to deserialize the split.", e);
     }
   }
+
+  byte[] serializeV2() throws IOException {
+    if (serializedBytesCache == null) {
+      DataOutputSerializer out = SERIALIZER_CACHE.get();
+      Collection<FileScanTask> fileScanTasks = task.tasks();
+      Preconditions.checkArgument(
+          fileOffset >= 0 && fileOffset < fileScanTasks.size(),
+          "Invalid file offset: %s. Should within the range of [0, %s)",

Review Comment:
   ```suggestion
             "Invalid file offset: %s. Should be within the range of [0, %s)",
   ```



##########
flink/v1.17/flink/src/main/java/org/apache/iceberg/flink/source/split/IcebergSourceSplit.java:
##########
@@ -120,4 +131,56 @@ static IcebergSourceSplit deserializeV1(byte[] serialized) 
throws IOException {
       throw new RuntimeException("Failed to deserialize the split.", e);
     }
   }
+
+  byte[] serializeV2() throws IOException {
+    if (serializedBytesCache == null) {
+      DataOutputSerializer out = SERIALIZER_CACHE.get();
+      Collection<FileScanTask> fileScanTasks = task.tasks();
+      Preconditions.checkArgument(
+          fileOffset >= 0 && fileOffset < fileScanTasks.size(),
+          "Invalid file offset: %s. Should within the range of [0, %s)",
+          fileOffset,
+          fileScanTasks.size());
+
+      out.writeInt(fileOffset);
+      out.writeLong(recordOffset);
+      out.writeInt(fileScanTasks.size());
+
+      Iterator<FileScanTask> iter = fileScanTasks.iterator();
+      int writtenTasks = 0;
+      while (iter.hasNext()) {
+        String taskJson = FileScanTaskParser.toJson(iter.next());
+        out.writeUTF(taskJson);
+        writtenTasks += 1;
+      }
+
+      Preconditions.checkArgument(
+          writtenTasks == fileScanTasks.size(),
+          "Invalid combined scan task: collection size = %s, iterator size = 
%s",

Review Comment:
   I'm not sure it's clear to a reader what the difference between `collection 
size` and `iterator size` is



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