From 14b8e3e4e1f6768585f787a32f6b40ac5473c0ba Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Mon, 19 Feb 2024 13:59:16 +0100 Subject: [PATCH] Fix failure on i386 --- cpp/src/parquet/encoding_test.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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