This is an automated email from the ASF dual-hosted git repository.
xndai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/master by this push:
new 8ac633f ORC-465: [C++] add a test for PATCHED_BASE with a big gap.
(#362)
8ac633f is described below
commit 8ac633f4e147c8f01d00c0ac78454bb8d1b825ea
Author: Fang Zheng <[email protected]>
AuthorDate: Fri Feb 15 14:19:23 2019 -0800
ORC-465: [C++] add a test for PATCHED_BASE with a big gap. (#362)
Fixes #362
---
c++/test/TestRleEncoder.cc | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/c++/test/TestRleEncoder.cc b/c++/test/TestRleEncoder.cc
index ceb4d05..f54e072 100644
--- a/c++/test/TestRleEncoder.cc
+++ b/c++/test/TestRleEncoder.cc
@@ -256,6 +256,30 @@ namespace orc {
runExampleTest(data, 20, expectedEncoded, 28);
}
+ TEST_P(RleTest, RleV2_Patched_base_big_gap) {
+ // The input data contains 512 values: data[0...510] are of a repeated
pattern of (2, 1), and
+ // the last value (i.e. data[511]) is equal to 1024. This makes the last
value to be the
+ // only patched value and the gap of this patch is 511.
+ const int numValues = 512;
+ int64_t data[512];
+ for (int i = 0; i < 511; i+=2) {
+ data[i] = 2;
+ data[i+1] = 1;
+ }
+ data[511] = 1024;
+
+ // Invoke the encoder.
+ const bool isSigned = true;
+ MemoryOutputStream memStream(DEFAULT_MEM_STREAM_SIZE);
+
+ std::unique_ptr<RleEncoder> encoder = getEncoder(RleVersion_2, memStream,
isSigned);
+ encoder->add(data, numValues, nullptr);
+ encoder->flush();
+
+ // Decode and verify.
+ decodeAndVerify(RleVersion_2, memStream, data, numValues, nullptr,
isSigned);
+ }
+
TEST_P(RleTest, RleV2_delta_example) {
int64_t data[10] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29};
unsigned char expectedEncoded[8] = {0xc6, 0x09, 0x02, 0x02, 0x22, 0x42,
0x42, 0x46};