[jira] [Created] (FLINK-16916) The logic of NullableSerializer#copy is wrong

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-16916) The logic of NullableSerializer#copy is wrong

Shang Yuanchun (Jira)
Congxian Qiu(klion26) created FLINK-16916:
---------------------------------------------

             Summary: The logic of NullableSerializer#copy is wrong
                 Key: FLINK-16916
                 URL: https://issues.apache.org/jira/browse/FLINK-16916
             Project: Flink
          Issue Type: Bug
          Components: API / Type Serialization System
    Affects Versions: 1.10.0, 1.9.2, 1.8.3
            Reporter: Congxian Qiu(klion26)
             Fix For: 1.11.0


When debugging the problem reported by FLINK-16724, Found that the logic of {{NullableSerializer#copy}} is wrong. currently, the logic is such as below:
{code:java}
public void copy(DataInputView source, DataOutputView target) throws IOException {
   boolean isNull = source.readBoolean();
   target.writeBoolean(isNull);
   if (isNull) {
      target.write(padding);
   }
   else {
      originalSerializer.copy(source, target);
   }
}

{code}
we forgot to skip {{paddings.length}} bytes when if the {{padding}}'s length is not 0.

We can correct the logic such as below 
{code:java}
public void copy(DataInputView source, DataOutputView target) throws IOException {
   boolean isNull = deserializeNull(source); // this will skip the padding values.
   target.writeBoolean(isNull);
   if (isNull) {
      target.write(padding);
   }
   else {
      originalSerializer.copy(source, target);
   }
}
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)