private void descReadBatchDataSerializableTest(int dataSize) {
    double E = 0.00001;
    String debugMsg = "Data size: " + dataSize + ", Data type: ";
    // test INT64
    TSDataType dataType = TSDataType.INT64;
    DescReadBatchData data = new DescReadBatchData(dataType);
    String fullMsg = debugMsg + dataType;
    for (int i = 1; i <= dataSize; i++) {
      data.putLong(i, i);
    }
    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(fullMsg, data2 instanceof DescReadBatchData);
    Assert.assertEquals(fullMsg, dataSize, data2.length());
    if (dataSize > 0) {
      Assert.assertEquals(fullMsg, 1L, data2.getMinTimestamp());
      Assert.assertEquals(fullMsg, dataSize, data2.getMaxTimestamp());
    }
    for (int i = 0; i < dataSize; i++) {
      Assert.assertEquals(fullMsg, i + 1, data2.getTimeByIndex(i));
      Assert.assertEquals(fullMsg, i + 1, data2.getLongByIndex(i));
    }
    for (int i = dataSize; i > 0; i--) {
      Assert.assertTrue(fullMsg, data2.hasCurrent());
      Assert.assertEquals(fullMsg, i, data2.currentTime());
      Assert.assertEquals(fullMsg, i, data2.getLong());
      data2.next();
    }
    Assert.assertFalse(fullMsg, data2.hasCurrent());
    // test INT32
    dataType = TSDataType.INT32;
    data = new DescReadBatchData(dataType);
    fullMsg = debugMsg + dataType;
    for (int i = 1; i <= dataSize; i++) {
      data.putInt(i, i);
    }
    baos = new ByteArrayOutputStream();
    outputStream = new DataOutputStream(baos);
    SerializeUtils.serializeBatchData(data, outputStream);
    buffer = ByteBuffer.wrap(baos.toByteArray());
    data2 = SerializeUtils.deserializeBatchData(buffer);
    Assert.assertTrue(fullMsg, data2 instanceof DescReadBatchData);
    Assert.assertEquals(fullMsg, dataSize, data2.length());
    if (dataSize > 0) {
      Assert.assertEquals(fullMsg, 1L, data2.getMinTimestamp());
      Assert.assertEquals(fullMsg, dataSize, data2.getMaxTimestamp());
    }
    for (int i = 0; i < dataSize; i++) {
      Assert.assertEquals(fullMsg, i + 1, data2.getTimeByIndex(i));
      Assert.assertEquals(fullMsg, i + 1, data2.getIntByIndex(i));
    }
    for (int i = dataSize; i > 0; i--) {
      Assert.assertTrue(fullMsg, data2.hasCurrent());
      Assert.assertEquals(fullMsg, i, data2.currentTime());
      Assert.assertEquals(fullMsg, i, data2.getInt());
      data2.next();
    }
    Assert.assertFalse(fullMsg, data2.hasCurrent());
    // test DOUBLE
    dataType = TSDataType.DOUBLE;
    data = new DescReadBatchData(dataType);
    fullMsg = debugMsg + dataType;
    for (int i = 1; i <= dataSize; i++) {
      data.putDouble(i, i);
    }
    baos = new ByteArrayOutputStream();
    outputStream = new DataOutputStream(baos);
    SerializeUtils.serializeBatchData(data, outputStream);
    buffer = ByteBuffer.wrap(baos.toByteArray());
    data2 = SerializeUtils.deserializeBatchData(buffer);
    Assert.assertTrue(fullMsg, data2 instanceof DescReadBatchData);
    Assert.assertEquals(fullMsg, dataSize, data2.length());
    if (dataSize > 0) {
      Assert.assertEquals(fullMsg, 1L, data2.getMinTimestamp());
      Assert.assertEquals(fullMsg, dataSize, data2.getMaxTimestamp());
    }
    for (int i = 0; i < dataSize; i++) {
      Assert.assertEquals(fullMsg, i + 1, data2.getTimeByIndex(i));
      Assert.assertEquals(fullMsg, i + 1, data2.getDoubleByIndex(i), E);
    }
    for (int i = dataSize; i > 0; i--) {
      Assert.assertTrue(fullMsg, data2.hasCurrent());
      Assert.assertEquals(fullMsg, i, data2.currentTime());
      Assert.assertEquals(fullMsg, i, data2.getDouble(), E);
      data2.next();
    }
    Assert.assertFalse(fullMsg, data2.hasCurrent());
    // test FLOAT
    dataType = TSDataType.FLOAT;
    data = new DescReadBatchData(dataType);
    fullMsg = debugMsg + dataType;
    for (int i = 1; i <= dataSize; i++) {
      data.putFloat(i, i);
    }
    baos = new ByteArrayOutputStream();
    outputStream = new DataOutputStream(baos);
    SerializeUtils.serializeBatchData(data, outputStream);
    buffer = ByteBuffer.wrap(baos.toByteArray());
    data2 = SerializeUtils.deserializeBatchData(buffer);
    Assert.assertTrue(fullMsg, data2 instanceof DescReadBatchData);
    Assert.assertEquals(fullMsg, dataSize, data2.length());
    if (dataSize > 0) {
      Assert.assertEquals(fullMsg, 1L, data2.getMinTimestamp());
      Assert.assertEquals(fullMsg, dataSize, data2.getMaxTimestamp());
    }
    for (int i = 0; i < dataSize; i++) {
      Assert.assertEquals(fullMsg, i + 1, data2.getTimeByIndex(i));
      Assert.assertEquals(fullMsg, i + 1, data2.getFloatByIndex(i), E);
    }
    for (int i = dataSize; i > 0; i--) {
      Assert.assertTrue(fullMsg, data2.hasCurrent());
      Assert.assertEquals(fullMsg, i, data2.currentTime());
      Assert.assertEquals(fullMsg, i, data2.getFloat(), E);
      data2.next();
    }
    Assert.assertFalse(fullMsg, data2.hasCurrent());
    // test BOOLEAN
    dataType = TSDataType.BOOLEAN;
    data = new DescReadBatchData(dataType);
    fullMsg = debugMsg + dataType;
    for (int i = 1; i <= dataSize; i++) {
      data.putBoolean(i, i % 3 == 0);
    }
    baos = new ByteArrayOutputStream();
    outputStream = new DataOutputStream(baos);
    SerializeUtils.serializeBatchData(data, outputStream);
    buffer = ByteBuffer.wrap(baos.toByteArray());
    data2 = SerializeUtils.deserializeBatchData(buffer);
    Assert.assertTrue(fullMsg, data2 instanceof DescReadBatchData);
    Assert.assertEquals(fullMsg, dataSize, data2.length());
    if (dataSize > 0) {
      Assert.assertEquals(fullMsg, 1L, data2.getMinTimestamp());
      Assert.assertEquals(fullMsg, dataSize, data2.getMaxTimestamp());
    }
    for (int i = 0; i < dataSize; i++) {
      Assert.assertEquals(fullMsg, i + 1, data2.getTimeByIndex(i));
      Assert.assertEquals(fullMsg, (i + 1) % 3 == 0, data2.getBooleanByIndex(i));
    }
    for (int i = dataSize; i > 0; i--) {
      Assert.assertTrue(fullMsg, data2.hasCurrent());
      Assert.assertEquals(fullMsg, i, data2.currentTime());
      Assert.assertEquals(fullMsg, i % 3 == 0, data2.getBoolean());
      data2.next();
    }
    Assert.assertFalse(fullMsg, data2.hasCurrent());
    // test BINARY
    dataType = TSDataType.TEXT;
    data = new DescReadBatchData(dataType);
    fullMsg = debugMsg + dataType;
    for (int i = 1; i <= dataSize; i++) {
      data.putBinary(i, BytesUtils.valueOf(String.valueOf(i)));
    }
    baos = new ByteArrayOutputStream();
    outputStream = new DataOutputStream(baos);
    SerializeUtils.serializeBatchData(data, outputStream);
    buffer = ByteBuffer.wrap(baos.toByteArray());
    data2 = SerializeUtils.deserializeBatchData(buffer);
    Assert.assertTrue(fullMsg, data2 instanceof DescReadBatchData);
    Assert.assertEquals(fullMsg, dataSize, data2.length());
    if (dataSize > 0) {
      Assert.assertEquals(fullMsg, 1L, data2.getMinTimestamp());
      Assert.assertEquals(fullMsg, dataSize, data2.getMaxTimestamp());
    }
    for (int i = 0; i < dataSize; i++) {
      Assert.assertEquals(fullMsg, i + 1, data2.getTimeByIndex(i));
      Assert.assertEquals(
          fullMsg,
          String.valueOf(i + 1),
          data2.getBinaryByIndex(i).getStringValue(TSFileConfig.STRING_CHARSET));
    }
    for (int i = dataSize; i > 0; i--) {
      Assert.assertTrue(fullMsg, data2.hasCurrent());
      Assert.assertEquals(fullMsg, i, data2.currentTime());
      Assert.assertEquals(
          fullMsg,
          String.valueOf(i),
          data2.getBinary().getStringValue(TSFileConfig.STRING_CHARSET));
      data2.next();
    }
    Assert.assertFalse(fullMsg, data2.hasCurrent());
    // test VECTOR
    dataType = TSDataType.VECTOR;
    data = new DescReadBatchData(dataType);
    fullMsg = debugMsg + dataType;
    for (int i = 1; i <= dataSize; i++) {
      data.putVector(
          i,
          new TsPrimitiveType[] {
            new TsPrimitiveType.TsLong(i),
            new TsPrimitiveType.TsInt(i),
            new TsPrimitiveType.TsDouble(i),
            new TsPrimitiveType.TsFloat(i),
            new TsPrimitiveType.TsBoolean(i % 3 == 0),
            new TsPrimitiveType.TsBinary(
                new Binary(String.valueOf(i), TSFileConfig.STRING_CHARSET)),
          });
    }
    baos = new ByteArrayOutputStream();
    outputStream = new DataOutputStream(baos);
    SerializeUtils.serializeBatchData(data, outputStream);
    buffer = ByteBuffer.wrap(baos.toByteArray());
    data2 = SerializeUtils.deserializeBatchData(buffer);
    Assert.assertTrue(fullMsg, data2 instanceof DescReadBatchData);
    Assert.assertEquals(fullMsg, dataSize, data2.length());
    if (dataSize > 0) {
      Assert.assertEquals(fullMsg, 1L, data2.getMinTimestamp());
      Assert.assertEquals(fullMsg, dataSize, data2.getMaxTimestamp());
    }
    for (int i = 0; i < dataSize; i++) {
      Assert.assertEquals(fullMsg, i + 1, data2.getTimeByIndex(i));
      Assert.assertArrayEquals(
          fullMsg,
          new TsPrimitiveType[] {
            new TsPrimitiveType.TsLong(i + 1),
            new TsPrimitiveType.TsInt(i + 1),
            new TsPrimitiveType.TsDouble(i + 1),
            new TsPrimitiveType.TsFloat(i + 1),
            new TsPrimitiveType.TsBoolean((i + 1) % 3 == 0),
            new TsPrimitiveType.TsBinary(
                new Binary(String.valueOf(i + 1), TSFileConfig.STRING_CHARSET)),
          },
          data2.getVectorByIndex(i));
    }
    for (int i = dataSize; i > 0; i--) {
      Assert.assertTrue(fullMsg, data2.hasCurrent());
      Assert.assertEquals(fullMsg, i, data2.currentTime());
      Assert.assertArrayEquals(
          fullMsg,
          new TsPrimitiveType[] {
            new TsPrimitiveType.TsLong(i),
            new TsPrimitiveType.TsInt(i),
            new TsPrimitiveType.TsDouble(i),
            new TsPrimitiveType.TsFloat(i),
            new TsPrimitiveType.TsBoolean(i % 3 == 0),
            new TsPrimitiveType.TsBinary(
                new Binary(String.valueOf(i), TSFileConfig.STRING_CHARSET)),
          },
          data2.getVector());
      data2.next();
    }
    Assert.assertFalse(fullMsg, data2.hasCurrent());
  }
This method tests SerializeUtils.serializeLongs() and SerializeUtils.deserializeLongs()
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/SerializeUtilsTest.java