pitrou commented on code in PR #41565:
URL: https://github.com/apache/arrow/pull/41565#discussion_r1592585953
##########
cpp/src/parquet/encoding.cc:
##########
@@ -3694,12 +3694,23 @@ class ByteStreamSplitDecoderBase : public DecoderImpl,
ByteStreamSplitDecoderBase(const ColumnDescriptor* descr, int byte_width)
: DecoderImpl(descr, Encoding::BYTE_STREAM_SPLIT),
byte_width_(byte_width) {}
- void SetData(int num_values, const uint8_t* data, int len) override {
- if (static_cast<int64_t>(num_values) * byte_width_ != len) {
+ void SetData(int num_values, const uint8_t* data, int len) final {
+ // Check that the data size is consistent with the number of values
+ // The spec requires that the data size is a multiple of the number of
values,
+ // see: https://github.com/apache/parquet-format/pull/192 .
+ // GH-41562: passed in `num_values` may include nulls, so we need to check
and
+ // adjust the number of values.
+ if (static_cast<int64_t>(num_values) * byte_width_ < len) {
throw ParquetException("Data size (" + std::to_string(len) +
") does not match number of values in
BYTE_STREAM_SPLIT (" +
Review Comment:
```suggestion
") is too small for the number of values in
BYTE_STREAM_SPLIT (" +
```
--
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]