Myasuka commented on a change in pull request #17755:
URL: https://github.com/apache/flink/pull/17755#discussion_r747181767



##########
File path: 
flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/RowSerializer.java
##########
@@ -540,14 +540,26 @@ protected int getCurrentOuterSnapshotVersion() {
 
         @Override
         protected void readOuterSnapshot(
-                int readOuterSnapshotVersion, DataInputView in, ClassLoader 
userCodeClassLoader) {
-            readVersion = readOuterSnapshotVersion;
+                int readOuterSnapshotVersion, DataInputView in, ClassLoader 
userCodeClassLoader)
+                throws IOException {
+            if (readOuterSnapshotVersion <= LAST_VERSION_WITHOUT_ROW_KIND) {
+                supportsRowKind = false;
+            } else if (readOuterSnapshotVersion == 
LAST_VERSION_WITHOUT_ROW_KIND + 1) {

Review comment:
       I think adding another new flag instead of 
`LAST_VERSION_WITHOUT_ROW_KIND + 1` would be better to understand.

##########
File path: 
flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/RowSerializer.java
##########
@@ -540,14 +540,26 @@ protected int getCurrentOuterSnapshotVersion() {
 
         @Override
         protected void readOuterSnapshot(
-                int readOuterSnapshotVersion, DataInputView in, ClassLoader 
userCodeClassLoader) {
-            readVersion = readOuterSnapshotVersion;
+                int readOuterSnapshotVersion, DataInputView in, ClassLoader 
userCodeClassLoader)
+                throws IOException {
+            if (readOuterSnapshotVersion <= LAST_VERSION_WITHOUT_ROW_KIND) {
+                supportsRowKind = false;
+            } else if (readOuterSnapshotVersion == 
LAST_VERSION_WITHOUT_ROW_KIND + 1) {
+                supportsRowKind = true;
+            } else {
+                supportsRowKind = in.readBoolean();
+            }
+        }
+
+        @Override
+        protected void writeOuterSnapshot(DataOutputView out) throws 
IOException {
+            out.writeBoolean(supportsRowKind);
         }
 
         @Override
         protected OuterSchemaCompatibility resolveOuterSchemaCompatibility(
                 RowSerializer newSerializer) {
-            if (readVersion <= LAST_VERSION_WITHOUT_ROW_KIND) {
+            if (supportsRowKind == newSerializer.legacyModeEnabled) {

Review comment:
       I think we should better to add description to describe the relationship 
between `supportsRowKind` with `legacyModeEnabled`.




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


Reply via email to