761417898 opened a new pull request, #118: URL: https://github.com/apache/tsfile/pull/118
https://github.com/apache/tsfile/issues/104 The TS2Diff decoder reads an extra byte after processing each group of data(TS2DIFFEncoder.block_size_ = 128), causing the header of the next group of data to be misaligned. Here are the unit tests, and the encoder's output is also consistent with the output from Java. ``` TEST_F(TS2DIFFEncoderTest, TestIntEncoding) { common::ByteStream out_stream(1024, common::MOD_TS2DIFF_OBJ, false); const int row_num = 10000; int32_t data[row_num]; memset(data, 0, sizeof(int32_t) * row_num); for (int i = 0; i < row_num; i++) { data[i] = i * i; } for (int i = 0; i < row_num; i++) { EXPECT_EQ(encoder_int_->encode(data[i], out_stream), common::E_OK); } EXPECT_EQ(encoder_int_->flush(out_stream), common::E_OK); for (int i = 0; i < row_num; i++) { int32_t x; EXPECT_EQ(decoder_int_->read_int32(x, out_stream), common::E_OK); EXPECT_EQ(x, data[i]); } } TEST_F(TS2DIFFEncoderTest, TestLongEncoding) { common::ByteStream out_stream(1024, common::MOD_TS2DIFF_OBJ, false); const int row_num = 10000; int64_t data[row_num]; memset(data, 0, sizeof(int64_t) * row_num); for (int i = 0; i < row_num; i++) { data[i] = i * i; } for (int i = 0; i < row_num; i++) { EXPECT_EQ(encoder_long_->encode(data[i], out_stream), common::E_OK); } EXPECT_EQ(encoder_long_->flush(out_stream), common::E_OK); for (int i = 0; i < row_num; i++) { int64_t x; EXPECT_EQ(decoder_long_->read_int64(x, out_stream), common::E_OK); EXPECT_EQ(x, data[i]); } } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
