diff --git a/cpp/src/parquet/encoding_test.cc b/cpp/src/parquet/encoding_test.cc index 60f334b2cfc58..ea0029f4c7d7f 100644 --- a/cpp/src/parquet/encoding_test.cc +++ b/cpp/src/parquet/encoding_test.cc @@ -1238,8 +1238,7 @@ class TestByteStreamSplitEncoding : public TestEncodingBase { encoder->PutSpaced(draws_, num_values_, valid_bits, valid_bits_offset); encode_buffer_ = encoder->FlushValues(); - ASSERT_EQ(encode_buffer_->size(), - static_cast(sizeof(c_type)) * (num_values_ - null_count)); + ASSERT_EQ(encode_buffer_->size(), physical_byte_width() * (num_values_ - null_count)); decoder->SetData(num_values_ - null_count, encode_buffer_->data(), static_cast(encode_buffer_->size())); auto values_decoded = decoder->DecodeSpaced(decode_buf_, num_values_, null_count, @@ -1302,6 +1301,11 @@ class TestByteStreamSplitEncoding : public TestEncodingBase { ASSERT_EQ(expected_encoded_data[i], encoded_data_raw[i]); } } + + int physical_byte_width() const { + return std::is_same_v ? descr_->type_length() + : static_cast(sizeof(c_type)); + } }; template