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.
---
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.
---