[
https://issues.apache.org/jira/browse/FLINK-2457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14659084#comment-14659084
]
ASF GitHub Bot commented on FLINK-2457:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/983#discussion_r36362299
--- Diff:
flink-java/src/main/java/org/apache/flink/api/java/typeutils/runtime/TupleSerializer.java
---
@@ -97,48 +97,63 @@ public T copy(T from) {
}
return target;
}
-
+
@Override
public T copy(T from, T reuse) {
for (int i = 0; i < arity; i++) {
Object copy =
fieldSerializers[i].copy(from.getField(i), reuse.getField(i));
reuse.setField(copy, i);
}
-
+
return reuse;
}
@Override
public void serialize(T value, DataOutputView target) throws
IOException {
- for (int i = 0; i < arity; i++) {
- Object o = value.getField(i);
- try {
- fieldSerializers[i].serialize(o, target);
- } catch (NullPointerException npex) {
- throw new NullFieldException(i, npex);
+ if (arity > 0) {
--- End diff --
IMO, it would be better if the TupleTypeInfo returns a special
Tuple0Serializer instead of doing this check for each record during execution.
> Integrate Tuple0
> ----------------
>
> Key: FLINK-2457
> URL: https://issues.apache.org/jira/browse/FLINK-2457
> Project: Flink
> Issue Type: Improvement
> Reporter: Matthias J. Sax
> Assignee: Matthias J. Sax
> Priority: Minor
>
> Tuple0 is not cleanly integrated:
> - missing serialization/deserialization support in runtime
> - Tuple.getTupleClass(int arity) cannot handle arity zero, ie, cannot create
> an instance of Tuple0
> Tuple0 is currently only used in Python API, but will be integrated into
> Storm compatibility, too.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)