Github user aljoscha commented on a diff in the pull request:
https://github.com/apache/flink/pull/906#discussion_r34503537
--- Diff:
flink-staging/flink-streaming/flink-streaming-core/src/main/java/org/apache/flink/streaming/runtime/streamrecord/StreamRecordSerializer.java
---
@@ -20,26 +20,35 @@
import java.io.IOException;
-import org.apache.flink.api.common.ExecutionConfig;
-import org.apache.flink.api.common.typeinfo.TypeInformation;
+import com.google.common.base.Preconditions;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.core.memory.DataInputView;
import org.apache.flink.core.memory.DataOutputView;
+import org.apache.flink.streaming.api.watermark.Watermark;
+
+/**
+ * Serializer for {@link StreamRecord} and {@link Watermark}. This does
not behave like a normal
+ * {@link TypeSerializer}, instead, this is only used at the
+ * {@link org.apache.flink.streaming.runtime.tasks.StreamTask} level for
transmitting
+ * {@link StreamRecord StreamRecords} and {@link Watermark Watermarks}.
This serializer
+ * can handle both of them, therefore it returns {@link Object} the result
has
+ * to be cast to the correct type.
+ *
+ * @param <T> The type of value in the {@link StreamRecord}
+ */
+public final class StreamRecordSerializer<T> extends
TypeSerializer<Object> {
-public final class StreamRecordSerializer<T> extends
TypeSerializer<StreamRecord<T>> {
+ private final long IS_WATERMARK = Long.MIN_VALUE;
--- End diff --
This is used as a special timestamp. When the deserializer deserializes it
it knows that the following long is a watermark. That's how the
StreamRecordSerializer can be used for both watermarks and records. I'll add a
comment.
---
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.
---