Github user shixiaogang commented on a diff in the pull request:
https://github.com/apache/flink/pull/3336#discussion_r102138099
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/query/netty/message/KvStateRequestSerializer.java
---
@@ -484,6 +487,71 @@ public static Throwable
deserializeServerFailure(ByteBuf buf) throws IOException
return null;
}
}
+
+ /**
+ * Serializes all values of the Iterable with the given serializer.
+ *
+ * @param entries Key-value pairs to serialize
+ * @param keySerializer Serializer for UK
+ * @param valueSerializer Serializer for UV
+ * @param <UK> Type of the keys
+ * @param <UV> Type of the values
+ * @return Serialized values or <code>null</code> if values
<code>null</code> or empty
+ * @throws IOException On failure during serialization
+ */
+ public static <UK, UV> byte[] serializeMap(Iterable<Map.Entry<UK, UV>>
entries, TypeSerializer<UK> keySerializer, TypeSerializer<UV> valueSerializer)
throws IOException {
+ if (entries != null) {
+ Iterator<Map.Entry<UK, UV>> it = entries.iterator();
+
+ if (it.hasNext()) {
+ // Serialize
+ DataOutputSerializer dos = new
DataOutputSerializer(32);
+
+ while (it.hasNext()) {
+ Map.Entry<UK, UV> entry = it.next();
+
+ keySerializer.serialize(entry.getKey(),
dos);
+
valueSerializer.serialize(entry.getValue(), dos);
+ }
+
+ return dos.getCopyOfBuffer();
+ } else {
+ return null;
--- End diff --
The function is unused now. I will delete it in the update.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---