Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-16916

The logic of NullableSerializer#copy is wrong

    XMLWordPrintableJSON

    Details

      Description

      When debugging the problem reported by FLINK-16724, Found that the logic of NullableSerializer#copy is wrong. currently, the logic is such as below:

      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);
         }
      }
      
      

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

      We can correct the logic such as below 

      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);
         }
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                klion26 Congxian Qiu
                Reporter:
                klion26 Congxian Qiu
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m