Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 4.3k
ARROW-17798: [C++][Parquet] Add DELTA_BINARY_PACKED encoder to Parquet writer#14191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
ed65e984b6c562327e01443fac721fd8212c3e5179cc1d74e50e0b6f4e11f418064b7fb29ab9109b8a32a8c3d2866b04ffa7f1cea068ea8187eb662ed68e54586c324c25ae5262ae22590999e1e1000af702b7a8d46251c01271e7File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -173,6 +173,40 @@ TEST(BitArray, TestMixed) { | ||||||
| } | ||||||
| } | ||||||
| // Write up to 'num_vals' values with width 'bit_width' and reads them back. | ||||||
| static void TestPutValue(int bit_width, uint64_t num_vals) { | ||||||
| // The max value representable in `bit_width` bits. | ||||||
| const uint64_t max = std::numeric_limits<uint64_t>::max() >> (64 - bit_width); | ||||||
| num_vals = std::min(num_vals, max); | ||||||
| int len = static_cast<int>(bit_util::BytesForBits(bit_width * num_vals)); | ||||||
| EXPECT_GT(len, 0); | ||||||
| std::vector<uint8_t> buffer(len); | ||||||
| bit_util::BitWriter writer(buffer.data(), len); | ||||||
| for (uint64_t i = max - num_vals; i < max; i++) { | ||||||
| bool result = writer.PutValue(i, bit_width); | ||||||
| EXPECT_TRUE(result); | ||||||
| } | ||||||
| writer.Flush(); | ||||||
| EXPECT_EQ(writer.bytes_written(), len); | ||||||
| bit_util::BitReader reader(buffer.data(), len); | ||||||
| for (uint64_t i = max - num_vals; i < max; i++) { | ||||||
| int64_t val = 0; | ||||||
| bool result = reader.GetValue(bit_width, &val); | ||||||
| EXPECT_TRUE(result); | ||||||
| EXPECT_EQ(val, i); | ||||||
| } | ||||||
| EXPECT_EQ(reader.bytes_left(), 0); | ||||||
| } | ||||||
| TEST(BitUtil, RoundTripIntValues) { | ||||||
| for (int width = 1; width < 64; width++) { | ||||||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally this should be:
Suggested change
MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reverted this because it causes an overflow to 0 and testing for Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you mean? Testing that we are able to write 64-bit values makes sense. Perhaps you want something like: // The max value representable in `bit_width` bits.constuint64_t max = std::numeric_limits<uint64_t>::max() >> (64 - bit_width);MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed to your proposal. It runs ok locally. MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
What I meant was that | ||||||
| TestPutValue(width, 1); | ||||||
| TestPutValue(width, 1024); | ||||||
| } | ||||||
| } | ||||||
| // Validates encoding of values by encoding and decoding them. If | ||||||
| // expected_encoding != NULL, also validates that the encoded buffer is | ||||||
| // exactly 'expected_encoding'. | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -400,7 +400,8 @@ typedef ::testing::Types<Int32Type, Int64Type, Int96Type, FloatType, DoubleType, | ||
| TYPED_TEST_SUITE(TestPrimitiveWriter, TestTypes); | ||
| using TestNullValuesWriter = TestPrimitiveWriter<Int32Type>; | ||
| using TestValuesWriterInt32Type = TestPrimitiveWriter<Int32Type>; | ||
| using TestValuesWriterInt64Type = TestPrimitiveWriter<Int64Type>; | ||
| TYPED_TEST(TestPrimitiveWriter, RequiredPlain) { | ||
| this->TestRequiredWithEncoding(Encoding::PLAIN); | ||
| @@ -418,23 +419,29 @@ TYPED_TEST(TestPrimitiveWriter, RequiredRLE) { | ||
| TYPED_TEST(TestPrimitiveWriter, RequiredBitPacked) { | ||
| this->TestRequiredWithEncoding(Encoding::BIT_PACKED); | ||
| } | ||
| */ | ||
| TEST_F(TestValuesWriterInt32Type, RequiredDeltaBinaryPacked) { | ||
| this->TestRequiredWithEncoding(Encoding::DELTA_BINARY_PACKED); | ||
| } | ||
| TYPED_TEST(TestPrimitiveWriter, RequiredDeltaBinaryPacked) { | ||
| TEST_F(TestValuesWriterInt64Type, RequiredDeltaBinaryPacked) { | ||
| this->TestRequiredWithEncoding(Encoding::DELTA_BINARY_PACKED); | ||
| } | ||
Comment on lines
424
to
430
MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@wgtmac I don't see where (and if) arrow_reader_writer_test.cc tests encodings. I've enabled this test as this is probably what you're suggesting. MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I misunderstood which line you were commenting due to GitHub interface. Still good to have these enabled. | ||
| /* | ||
| TYPED_TEST(TestPrimitiveWriter, RequiredDeltaLengthByteArray) { | ||
| this->TestRequiredWithEncoding(Encoding::DELTA_LENGTH_BYTE_ARRAY); | ||
| } | ||
| TYPED_TEST(TestPrimitiveWriter, RequiredDeltaByteArray) { | ||
| this->TestRequiredWithEncoding(Encoding::DELTA_BYTE_ARRAY); | ||
| } | ||
| */ | ||
| TYPED_TEST(TestPrimitiveWriter, RequiredRLEDictionary) { | ||
| this->TestRequiredWithEncoding(Encoding::RLE_DICTIONARY); | ||
| } | ||
| */ | ||
| TYPED_TEST(TestPrimitiveWriter, RequiredPlainWithStats) { | ||
| this->TestRequiredWithSettings(Encoding::PLAIN, Compression::UNCOMPRESSED, false, true, | ||
| @@ -647,7 +654,7 @@ TEST(TestWriter, NullValuesBuffer) { | ||
| // PARQUET-719 | ||
| // Test case for NULL values | ||
| TEST_F(TestNullValuesWriter, OptionalNullValueChunk) { | ||
| TEST_F(TestValuesWriterInt32Type, OptionalNullValueChunk) { | ||
| this->SetUpSchema(Repetition::OPTIONAL); | ||
| this->GenerateData(LARGE_SIZE); | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.