diff --git a/cpp/src/arrow/compute/row/compare_internal.cc b/cpp/src/arrow/compute/row/compare_internal.cc index 89e3f8deea5b9..47051e87e06e7 100644 --- a/cpp/src/arrow/compute/row/compare_internal.cc +++ b/cpp/src/arrow/compute/row/compare_internal.cc @@ -105,7 +105,7 @@ void KeyCompare::CompareBinaryColumnToRowHelper( for (int32_t i = first_row_to_compare; i < num_rows_to_compare; ++i) { uint32_t irow_left = use_selection ? sel_left_maybe_null[i] : i; uint32_t irow_right = left_to_right_map[irow_left]; - uint32_t offset_right = irow_right * fixed_length + offset_within_row; + int32_t offset_right = irow_right * fixed_length + offset_within_row; match_bytevector[i] = compare_fn(rows_left, rows_right, irow_left, offset_right); } } else { diff --git a/cpp/src/arrow/compute/row/encode_internal.cc b/cpp/src/arrow/compute/row/encode_internal.cc index 96e6a816095a9..d50a380509c13 100644 --- a/cpp/src/arrow/compute/row/encode_internal.cc +++ b/cpp/src/arrow/compute/row/encode_internal.cc @@ -163,7 +163,7 @@ Status RowTableEncoder::EncodeSelected(RowTableImpl* rows, uint32_t num_selected for (size_t icol = 0; icol < batch_all_cols_.size(); ++icol) { if (batch_all_cols_[icol].metadata().is_fixed_length) { - uint32_t offset_within_row = rows->metadata().column_offsets[icol]; + int32_t offset_within_row = rows->metadata().column_offsets[icol]; EncoderBinary::EncodeSelected(offset_within_row, rows, batch_all_cols_[icol], num_selected, selection); } @@ -188,7 +188,7 @@ struct TransformBoolean { const KeyColumnArray& temp) { // Make sure that the temp buffer is large enough DCHECK(temp.length() >= column.length() && temp.metadata().is_fixed_length && - temp.metadata().fixed_length >= int32_t(sizeof(uint8_t))); + temp.metadata().fixed_length >= static_cast(sizeof(uint8_t))); KeyColumnMetadata metadata; metadata.is_fixed_length = true; metadata.fixed_length = sizeof(uint8_t); @@ -238,7 +238,7 @@ void EncoderInteger::PostDecode(const KeyColumnArray& input, KeyColumnArray* out } void EncoderInteger::Decode(uint32_t start_row, uint32_t num_rows, - uint32_t offset_within_row, const RowTableImpl& rows, + int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col, LightContext* ctx, KeyColumnArray* temp) { KeyColumnArray col_prep; @@ -327,7 +327,7 @@ void EncoderInteger::Decode(uint32_t start_row, uint32_t num_rows, } template -void EncoderBinary::EncodeSelectedImp(uint32_t offset_within_row, RowTableImpl* rows, +void EncoderBinary::EncodeSelectedImp(int32_t offset_within_row, RowTableImpl* rows, const KeyColumnArray& col, uint32_t num_selected, const uint16_t* selection, COPY_FN copy_fn, SET_NULL_FN set_null_fn) { @@ -372,7 +372,7 @@ void EncoderBinary::EncodeSelectedImp(uint32_t offset_within_row, RowTableImpl* } } -void EncoderBinary::EncodeSelected(uint32_t offset_within_row, RowTableImpl* rows, +void EncoderBinary::EncodeSelected(int32_t offset_within_row, RowTableImpl* rows, const KeyColumnArray& col, uint32_t num_selected, const uint16_t* selection) { if (col.metadata().is_null_type) { @@ -441,7 +441,7 @@ bool EncoderBinary::IsInteger(const KeyColumnMetadata& metadata) { } void EncoderBinary::Decode(uint32_t start_row, uint32_t num_rows, - uint32_t offset_within_row, const RowTableImpl& rows, + int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col, LightContext* ctx, KeyColumnArray* temp) { if (IsInteger(col->metadata())) { EncoderInteger::Decode(start_row, num_rows, offset_within_row, rows, col, ctx, temp); @@ -478,7 +478,7 @@ void EncoderBinary::Decode(uint32_t start_row, uint32_t num_rows, template void EncoderBinary::DecodeImp(uint32_t start_row, uint32_t num_rows, - uint32_t offset_within_row, const RowTableImpl& rows, + int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col) { DecodeHelper( start_row, num_rows, offset_within_row, &rows, nullptr, col, col, @@ -492,7 +492,7 @@ void EncoderBinary::DecodeImp(uint32_t start_row, uint32_t num_rows, } void EncoderBinaryPair::Decode(uint32_t start_row, uint32_t num_rows, - uint32_t offset_within_row, const RowTableImpl& rows, + int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col1, KeyColumnArray* col2, LightContext* ctx, KeyColumnArray* temp1, KeyColumnArray* temp2) { @@ -567,7 +567,7 @@ void EncoderBinaryPair::Decode(uint32_t start_row, uint32_t num_rows, template void EncoderBinaryPair::DecodeImp(uint32_t num_rows_to_skip, uint32_t start_row, - uint32_t num_rows, uint32_t offset_within_row, + uint32_t num_rows, int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col1, KeyColumnArray* col2) { DCHECK(rows.length() >= start_row + num_rows); @@ -648,11 +648,11 @@ void EncoderOffsets::Decode(uint32_t start_row, uint32_t num_rows, const int32_t* varbinary_ends = rows.metadata().varbinary_end_array(row); // Update the offset of each column - uint32_t offset_within_row = rows.metadata().fixed_length; + int32_t offset_within_row = rows.metadata().fixed_length; for (size_t col = 0; col < varbinary_cols->size(); ++col) { offset_within_row += RowTableMetadata::padding_for_alignment(offset_within_row, string_alignment); - uint32_t length = varbinary_ends[col] - offset_within_row; + int32_t length = varbinary_ends[col] - offset_within_row; offset_within_row = varbinary_ends[col]; int32_t* col_offsets = (*varbinary_cols)[col].mutable_offsets(); col_offsets[i + 1] = col_offsets[i] + length; @@ -848,7 +848,8 @@ void EncoderVarBinary::EncodeSelected(uint32_t ivarbinary, RowTableImpl* rows, if (ivarbinary == 0) { for (uint32_t i = 0; i < num_selected; ++i) { uint8_t* row = row_base + row_offsets[i]; - int32_t row_offset, length; + int32_t row_offset; + int32_t length; rows->metadata().first_varbinary_offset_and_length(row, &row_offset, &length); uint32_t irow = selection[i]; memcpy(row + row_offset, col_base + col_offsets[irow], length); @@ -856,7 +857,8 @@ void EncoderVarBinary::EncodeSelected(uint32_t ivarbinary, RowTableImpl* rows, } else { for (uint32_t i = 0; i < num_selected; ++i) { uint8_t* row = row_base + row_offsets[i]; - int32_t row_offset, length; + int32_t row_offset; + int32_t length; rows->metadata().nth_varbinary_offset_and_length(row, ivarbinary, &row_offset, &length); uint32_t irow = selection[i]; diff --git a/cpp/src/arrow/compute/row/encode_internal.h b/cpp/src/arrow/compute/row/encode_internal.h index 653dbc677cdea..296e917d95262 100644 --- a/cpp/src/arrow/compute/row/encode_internal.h +++ b/cpp/src/arrow/compute/row/encode_internal.h @@ -122,7 +122,7 @@ class ARROW_EXPORT RowTableEncoder { class EncoderInteger { public: - static void Decode(uint32_t start_row, uint32_t num_rows, uint32_t offset_within_row, + static void Decode(uint32_t start_row, uint32_t num_rows, int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col, LightContext* ctx, KeyColumnArray* temp); static bool UsesTransform(const KeyColumnArray& column); @@ -137,24 +137,24 @@ class EncoderInteger { class EncoderBinary { public: - static void EncodeSelected(uint32_t offset_within_row, RowTableImpl* rows, + static void EncodeSelected(int32_t offset_within_row, RowTableImpl* rows, const KeyColumnArray& col, uint32_t num_selected, const uint16_t* selection); - static void Decode(uint32_t start_row, uint32_t num_rows, uint32_t offset_within_row, + static void Decode(uint32_t start_row, uint32_t num_rows, int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col, LightContext* ctx, KeyColumnArray* temp); static bool IsInteger(const KeyColumnMetadata& metadata); private: template - static void EncodeSelectedImp(uint32_t offset_within_row, RowTableImpl* rows, + static void EncodeSelectedImp(int32_t offset_within_row, RowTableImpl* rows, const KeyColumnArray& col, uint32_t num_selected, const uint16_t* selection, COPY_FN copy_fn, SET_NULL_FN set_null_fn); template static inline void DecodeHelper(uint32_t start_row, uint32_t num_rows, - uint32_t offset_within_row, + int32_t offset_within_row, const RowTableImpl* rows_const, RowTableImpl* rows_mutable_maybe_null, const KeyColumnArray* col_const, @@ -185,15 +185,15 @@ class EncoderBinary { } template - static void DecodeImp(uint32_t start_row, uint32_t num_rows, uint32_t offset_within_row, + static void DecodeImp(uint32_t start_row, uint32_t num_rows, int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col); #if defined(ARROW_HAVE_RUNTIME_AVX2) static void DecodeHelper_avx2(bool is_row_fixed_length, uint32_t start_row, - uint32_t num_rows, uint32_t offset_within_row, + uint32_t num_rows, int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col); template static void DecodeImp_avx2(uint32_t start_row, uint32_t num_rows, - uint32_t offset_within_row, const RowTableImpl& rows, + int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col); #endif }; @@ -204,23 +204,23 @@ class EncoderBinaryPair { const KeyColumnMetadata& col2) { return EncoderBinary::IsInteger(col1) && EncoderBinary::IsInteger(col2); } - static void Decode(uint32_t start_row, uint32_t num_rows, uint32_t offset_within_row, + static void Decode(uint32_t start_row, uint32_t num_rows, int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col1, KeyColumnArray* col2, LightContext* ctx, KeyColumnArray* temp1, KeyColumnArray* temp2); private: template static void DecodeImp(uint32_t num_rows_to_skip, uint32_t start_row, uint32_t num_rows, - uint32_t offset_within_row, const RowTableImpl& rows, + int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col1, KeyColumnArray* col2); #if defined(ARROW_HAVE_RUNTIME_AVX2) static uint32_t DecodeHelper_avx2(bool is_row_fixed_length, uint32_t col_width, uint32_t start_row, uint32_t num_rows, - uint32_t offset_within_row, const RowTableImpl& rows, + int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col1, KeyColumnArray* col2); template static uint32_t DecodeImp_avx2(uint32_t start_row, uint32_t num_rows, - uint32_t offset_within_row, const RowTableImpl& rows, + int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col1, KeyColumnArray* col2); #endif }; @@ -278,7 +278,8 @@ class EncoderVarBinary { int32_t row_offset = row_offsets_for_batch[i]; const uint8_t* row = rows_const->data(2) + row_offset; - int32_t offset_within_row, length; + int32_t offset_within_row; + int32_t length; if (first_varbinary_col) { rows_const->metadata().first_varbinary_offset_and_length(row, &offset_within_row, &length); diff --git a/cpp/src/arrow/compute/row/encode_internal_avx2.cc b/cpp/src/arrow/compute/row/encode_internal_avx2.cc index 628d5c1d13cad..85f72914996da 100644 --- a/cpp/src/arrow/compute/row/encode_internal_avx2.cc +++ b/cpp/src/arrow/compute/row/encode_internal_avx2.cc @@ -23,7 +23,7 @@ namespace arrow { namespace compute { void EncoderBinary::DecodeHelper_avx2(bool is_row_fixed_length, uint32_t start_row, - uint32_t num_rows, uint32_t offset_within_row, + uint32_t num_rows, int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col) { if (is_row_fixed_length) { DecodeImp_avx2(start_row, num_rows, offset_within_row, rows, col); @@ -34,7 +34,7 @@ void EncoderBinary::DecodeHelper_avx2(bool is_row_fixed_length, uint32_t start_r template void EncoderBinary::DecodeImp_avx2(uint32_t start_row, uint32_t num_rows, - uint32_t offset_within_row, const RowTableImpl& rows, + int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col) { DecodeHelper( start_row, num_rows, offset_within_row, &rows, nullptr, col, col, @@ -49,10 +49,10 @@ void EncoderBinary::DecodeImp_avx2(uint32_t start_row, uint32_t num_rows, uint32_t EncoderBinaryPair::DecodeHelper_avx2( bool is_row_fixed_length, uint32_t col_width, uint32_t start_row, uint32_t num_rows, - uint32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col1, + int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col1, KeyColumnArray* col2) { using DecodeImp_avx2_t = - uint32_t (*)(uint32_t start_row, uint32_t num_rows, uint32_t offset_within_row, + uint32_t (*)(uint32_t start_row, uint32_t num_rows, int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col1, KeyColumnArray* col2); static const DecodeImp_avx2_t DecodeImp_avx2_fn[] = { DecodeImp_avx2, DecodeImp_avx2, DecodeImp_avx2, @@ -66,7 +66,7 @@ uint32_t EncoderBinaryPair::DecodeHelper_avx2( template uint32_t EncoderBinaryPair::DecodeImp_avx2(uint32_t start_row, uint32_t num_rows, - uint32_t offset_within_row, + int32_t offset_within_row, const RowTableImpl& rows, KeyColumnArray* col1, KeyColumnArray* col2) { ARROW_DCHECK(col_width == 1 || col_width == 2 || col_width == 4 || col_width == 8);