You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@iotdb.apache.org by "Eric Pai (Jira)" <ji...@apache.org> on 2021/11/10 04:25:00 UTC

[jira] [Created] (IOTDB-1983) Incorrect of deserializing DescReadWriteBatchData

Eric Pai created IOTDB-1983:
-------------------------------

             Summary: Incorrect of deserializing DescReadWriteBatchData
                 Key: IOTDB-1983
                 URL: https://issues.apache.org/jira/browse/IOTDB-1983
             Project: Apache IoTDB
          Issue Type: Bug
            Reporter: Eric Pai
            Assignee: Eric Pai
             Fix For: master branch, 0.12.3


For example, If I initialize an INT64 type DescReadWriteBatchData, and put (time, value) like (1, 1), (2,2), (3,3) in order, the timeRet of this DescReadWriteBatchData is [...., 3,2,1] as our expected. But after serializing and deserializing by SerializeUtils, we get a new DescReadWriteBatchData which has the timeRet [..., 1, 2, 3], which is inconsistent with the original one.

It's bug actually, but {color:#de350b}I'm not sure the meaning of the index parameter of BatchData.getXXXByIndex. Is it the index of the data write sequence, no matter what the batchDataType is?{color}

The unit test codes here(you can put them into SerializeUtilsTest)

 
{code:java}
@Test
public void descReadWriteBatchDataSerializableTest() {
  DescReadWriteBatchData data = new DescReadWriteBatchData(TSDataType.INT64);
  data.putLong(1, 1L);
  data.putLong(2, 2L);
  data.putLong(3, 3L);

  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  DataOutputStream outputStream = new DataOutputStream(baos);
  SerializeUtils.serializeBatchData(data, outputStream);
  ByteBuffer buffer = ByteBuffer.wrap(baos.toByteArray());
  BatchData data2 = SerializeUtils.deserializeBatchData(buffer);
  Assert.assertTrue(data2 instanceof DescReadWriteBatchData);
  Assert.assertTrue(data2.hasCurrent());
  Assert.assertEquals(3L, data2.getLongByIndex(0));
  data2.next();
  Assert.assertTrue(data2.hasCurrent());
  Assert.assertEquals(2L, data2.getLongByIndex(1));
  data2.next();
  Assert.assertTrue(data2.hasCurrent());
  Assert.assertEquals(1L, data2.getLongByIndex(2));
  data2.next();
  Assert.assertFalse(data2.hasCurrent());
} {code}
 

 

 

 

 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)