mxm commented on code in PR #11662:
URL: https://github.com/apache/iceberg/pull/11662#discussion_r1863289530


##########
flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/sink/shuffle/SortKeySerializer.java:
##########
@@ -310,10 +324,16 @@ public void writeSnapshot(DataOutputView out) throws 
IOException {
     @Override
     public void readSnapshot(int readVersion, DataInputView in, ClassLoader 
userCodeClassLoader)
         throws IOException {
-      if (readVersion == 1) {
-        readV1(in);
-      } else {
-        throw new IllegalArgumentException("Unknown read version: " + 
readVersion);
+      switch (readVersion) {
+        case 1:
+          throw new UnsupportedOperationException(
+              String.format(
+                  "No longer supported version [%s]. Please upgrade first . ", 
readVersion));
+        case 2:
+          readV2(in);
+          break;

Review Comment:
   Reading the snapshot isn't any different for V1/V2. The `readV1()` or 
`readV2()` methods are identical. We can just keep the current one. However, we 
need to save the serializer version as an `int` field which we can read in 
`restoreSerializer()` to pass it into the serializer, just like the schema and 
the sort order. We can then serialize/deserialize depending on the version used.
   
   For example, in the serializer we would do:
   ```
   if (version == 1) {
     // Don't read/write null indicator
   } else {
     // Read/write null indicator
   }



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