[
https://issues.apache.org/jira/browse/FLINK-6764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16031117#comment-16031117
]
ASF GitHub Bot commented on FLINK-6764:
---------------------------------------
Github user StefanRRichter commented on a diff in the pull request:
https://github.com/apache/flink/pull/4026#discussion_r119348235
--- Diff:
flink-core/src/test/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializerTest.java
---
@@ -606,6 +665,45 @@ public void
testSerializerSerializationFailureResilience() throws Exception {
verifyPojoSerializerConfigSnapshotWithEmptyNestedSerializers(config,
deserializedConfig);
}
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testNonDuplicatedStatelessSerializersInConfigSnapshot()
throws IOException {
+ PojoSerializer<TestUserClassWithSameFieldTypes> pojoSerializer
= (PojoSerializer<TestUserClassWithSameFieldTypes>)
+
TypeExtractor.getForClass(TestUserClassWithSameFieldTypes.class).createSerializer(new
ExecutionConfig());
+
+ // snapshot configuration and serialize to bytes
+
PojoSerializer.PojoSerializerConfigSnapshot<TestUserClassWithSameFieldTypes>
config = pojoSerializer.snapshotConfiguration();
+ byte[] serializedConfig;
+ try (
+ ByteArrayOutputStream out = new
ByteArrayOutputStream()) {
+
TypeSerializerSerializationUtil.writeSerializerConfigSnapshot(new
DataOutputViewStreamWrapper(out), config);
+ serializedConfig = out.toByteArray();
+ }
+
+ // read configuration from bytes
+ PojoSerializer.PojoSerializerConfigSnapshot<TestUserClass>
deserializedConfig;
+ try(ByteArrayInputStream in = new
ByteArrayInputStream(serializedConfig)) {
--- End diff --
There is also a `ByteArrayInputStreamWithPos`.
> Deduplicate stateless TypeSerializers when serializing composite
> TypeSerializers
> --------------------------------------------------------------------------------
>
> Key: FLINK-6764
> URL: https://issues.apache.org/jira/browse/FLINK-6764
> Project: Flink
> Issue Type: Improvement
> Components: Type Serialization System
> Affects Versions: 1.3.0, 1.4.0
> Reporter: Till Rohrmann
> Assignee: Tzu-Li (Gordon) Tai
>
> Composite type serializer, such as the {{PojoSerializer}}, could be improved
> by deduplicating stateless {{TypeSerializer}} when being serialized. This
> would decrease their serialization size.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)