rkhachatryan commented on a change in pull request #18391:
URL: https://github.com/apache/flink/pull/18391#discussion_r805145681



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/state/changelog/ChangelogStateBackendHandle.java
##########
@@ -154,14 +177,51 @@ public String toString() {
                     keyGroupRange, materialized.size(), 
nonMaterialized.size());
         }
 
-        private static Closeable asCloseable(KeyedStateHandle h) {
-            return () -> {
-                try {
-                    h.discardState();
-                } catch (Exception e) {
-                    ExceptionUtils.rethrowIOException(e);
+        private static class StreamStateHandleWrapper implements 
StreamStateHandle {
+            private static final long serialVersionUID = 1L;
+
+            private final KeyedStateHandle keyedStateHandle;
+
+            StreamStateHandleWrapper(KeyedStateHandle keyedStateHandle) {
+                this.keyedStateHandle = keyedStateHandle;
+            }
+
+            @Override
+            public void discardState() throws Exception {
+                keyedStateHandle.discardState();
+            }
+
+            @Override
+            public long getStateSize() {
+                return keyedStateHandle.getStateSize();
+            }
+
+            @Override
+            public FSDataInputStream openInputStream() throws IOException {
+                throw new UnsupportedOperationException("Should not call 
here.");
+            }
+
+            @Override
+            public Optional<byte[]> asBytesIfInMemory() {
+                throw new UnsupportedOperationException("Should not call 
here.");
+            }
+
+            @Override
+            public boolean equals(Object o) {

Review comment:
       Actually, we DO need these methods because `SharedStateRegistry` uses 
`equals` to find duplicates.
   Sorry for a misleading comment.




-- 
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...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to