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

BaseRowSerializer.toBinaryRow wrongly process null for non-compact decimal

    XMLWordPrintableJSON

Details

    Description

      Take non-compact decimal(precision > 18 null as an example, the writer not only need to set null bits, but also need to assign bytes of variable-length part for future update. The following test case can reproduce the problem.

       

       

      @Test
      public void test() {
         Decimal dec = Decimal.fromBigDecimal(new BigDecimal(11), 38, 0);
      
         BinaryRow row1 = new BinaryRow(2);
         BinaryRowWriter writer = new BinaryRowWriter(row1);
         writer.writeDecimal(0, dec, 38);
         writer.writeDecimal(1, null, 38);
         writer.complete();
      
         BaseRowSerializer serializer = new BaseRowSerializer(null, RowType.of(new DecimalType(38, 0), new DecimalType(38, 0)));
         GenericRow row2 = new GenericRow(2);
         row2.setField(0, dec);
         row2.setField(1, null);
         BinaryRow row3 = serializer.toBinaryRow(row2);
      
         assertTrue(row1.equalsWithoutHeader(row3));
      }
      
      

       

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              docete Zhenghua Gao
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: