Skip to content

Commit ded3e67

Browse files
committed
Static assert the size of offset type in row table at where assumes it
1 parent 0082bca commit ded3e67

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

cpp/src/arrow/acero/swiss_join_avx2.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ int RowArrayAccessor::Visit_avx2(const RowTableImpl& rows, int column_id, int nu
4949
int varbinary_column_id = VarbinaryColumnId(rows.metadata(), column_id);
5050
const uint8_t* row_ptr_base = rows.data(2);
5151
const RowTableImpl::offset_type* row_offsets = rows.offsets();
52+
static_assert(
53+
sizeof(RowTableImpl::offset_type) == sizeof(int64_t),
54+
"RowArrayAccessor::Visit_avx2 only supports 64-bit RowTableImpl::offset_type");
5255

5356
if (varbinary_column_id == 0) {
5457
// Case 1: This is the first varbinary column

cpp/src/arrow/compute/row/compare_internal_avx2.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ uint32_t KeyCompare::CompareBinaryColumnToRowHelper_avx2(
251251
_mm256_loadu_si256(reinterpret_cast<const __m256i*>(left_to_right_map) + i);
252252
}
253253

254+
static_assert(sizeof(RowTableImpl::offset_type) == sizeof(int64_t),
255+
"KeyCompare::CompareBinaryColumnToRowHelper_avx2 only supports "
256+
"64-bit RowTableImpl::offset_type");
254257
auto offsets_right_i64 =
255258
reinterpret_cast<const arrow::util::int64_for_gather_t*>(offsets_right);
256259
// Gather the lower/higher 4 64-bit row offsets based on the lower/higher 4 32-bit
@@ -415,6 +418,9 @@ inline uint64_t Compare8_Binary_avx2(uint32_t length, const uint8_t* left_base,
415418
if (use_selection) {
416419
_mm256_storeu_si256(reinterpret_cast<__m256i*>(irow_left_array), irow_left);
417420
}
421+
static_assert(
422+
sizeof(RowTableImpl::offset_type) * 4 == sizeof(__m256i),
423+
"Unexpected RowTableImpl::offset_type size in KeyCompare::Compare8_Binary_avx2");
418424
_mm256_storeu_si256(reinterpret_cast<__m256i*>(offset_right_array), offset_right_lo);
419425
_mm256_storeu_si256(reinterpret_cast<__m256i*>(&offset_right_array[4]),
420426
offset_right_hi);

0 commit comments

Comments
 (0)