AntoinePrv commented on code in PR #50422:
URL: https://github.com/apache/arrow/pull/50422#discussion_r3552485125
##########
cpp/src/arrow/util/rle_encoding_test.cc:
##########
@@ -1102,6 +1142,60 @@ void CheckRoundTrip(const Array& data, int bit_width,
bool spaced, int32_t parts
}
}
+/// Check RleBitPackedDecoder::Advance, which spans multiple runs through the
+/// parser (unlike the per-run decoder Advance).
+///
+/// Nulls are treated as regular data (i.e. their raw value is encoded and
+/// decoded). Advance and GetBatch are interleaved so that run boundaries are
+/// crossed and partial runs consumed, verifying decoded values as we go.
+template <typename Type>
+void CheckAdvance(const Array& data, int bit_width) {
+ using ArrayType = typename TypeTraits<Type>::ArrayType;
+ using value_type = typename Type::c_type;
+
+ const auto data_size = static_cast<rle_size_t>(data.length());
+ const value_type* data_values = static_cast<const
ArrayType&>(data).raw_values();
+
+ ARROW_SCOPED_TRACE("bit_width = ", bit_width, ", data_size = ", data_size);
+
+ // Encode all values into `buffer`.
+ const auto buffer = EncodeTestArray<Type>(data, bit_width);
+
+ // Interleave Advance and GetBatch, verifying decoded values against the
original.
+ RleBitPackedDecoder<value_type> decoder(buffer.data(),
static_cast<int>(buffer.size()),
+ bit_width);
+ rle_size_t pos = 0;
+ auto advance = [&](rle_size_t* pos, rle_size_t n) {
Review Comment:
Ha yes, I added it because otherwise Clang emitted a warning for an infinite
loop (it did not see that `pos` could be modified).
--
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]