MCPcopy Create free account
hub / github.com/apache/arrow / CompareBinaryColumnToRow

Method CompareBinaryColumnToRow

cpp/src/arrow/compute/row/compare_internal.cc:123–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121
122template <bool use_selection>
123void KeyCompare::CompareBinaryColumnToRow(uint32_t offset_within_row,
124 uint32_t num_rows_to_compare,
125 const uint16_t* sel_left_maybe_null,
126 const uint32_t* left_to_right_map,
127 LightContext* ctx, const KeyColumnArray& col,
128 const RowTableImpl& rows,
129 uint8_t* match_bytevector) {
130 uint32_t num_processed = 0;
131#if defined(ARROW_HAVE_RUNTIME_AVX2)
132 if (ctx->has_avx2()) {
133 num_processed = CompareBinaryColumnToRow_avx2(
134 use_selection, offset_within_row, num_rows_to_compare, sel_left_maybe_null,
135 left_to_right_map, ctx, col, rows, match_bytevector);
136 }
137#endif
138
139 uint32_t col_width = col.metadata().fixed_length;
140 if (col_width == 0) {
141 int bit_offset = col.bit_offset(1);
142 CompareBinaryColumnToRowHelper<use_selection>(
143 offset_within_row, num_processed, num_rows_to_compare, sel_left_maybe_null,
144 left_to_right_map, ctx, col, rows, match_bytevector,
145 [bit_offset](const uint8_t* left_base, const uint8_t* right_base,
146 uint32_t irow_left, RowTableImpl::offset_type offset_right) {
147 uint8_t left =
148 bit_util::GetBit(left_base, irow_left + bit_offset) ? 0xff : 0x00;
149 uint8_t right = right_base[offset_right];
150 return left == right ? 0xff : 0;
151 });
152 } else if (col_width == 1) {
153 CompareBinaryColumnToRowHelper<use_selection>(
154 offset_within_row, num_processed, num_rows_to_compare, sel_left_maybe_null,
155 left_to_right_map, ctx, col, rows, match_bytevector,
156 [](const uint8_t* left_base, const uint8_t* right_base, uint32_t irow_left,
157 RowTableImpl::offset_type offset_right) {
158 uint8_t left = left_base[irow_left];
159 uint8_t right = right_base[offset_right];
160 return left == right ? 0xff : 0;
161 });
162 } else if (col_width == 2) {
163 CompareBinaryColumnToRowHelper<use_selection>(
164 offset_within_row, num_processed, num_rows_to_compare, sel_left_maybe_null,
165 left_to_right_map, ctx, col, rows, match_bytevector,
166 [](const uint8_t* left_base, const uint8_t* right_base, uint32_t irow_left,
167 RowTableImpl::offset_type offset_right) {
168 util::CheckAlignment<uint16_t>(left_base);
169 util::CheckAlignment<uint16_t>(right_base + offset_right);
170 uint16_t left = reinterpret_cast<const uint16_t*>(left_base)[irow_left];
171 uint16_t right = *reinterpret_cast<const uint16_t*>(right_base + offset_right);
172 return left == right ? 0xff : 0;
173 });
174 } else if (col_width == 4) {
175 CompareBinaryColumnToRowHelper<use_selection>(
176 offset_within_row, num_processed, num_rows_to_compare, sel_left_maybe_null,
177 left_to_right_map, ctx, col, rows, match_bytevector,
178 [](const uint8_t* left_base, const uint8_t* right_base, uint32_t irow_left,
179 RowTableImpl::offset_type offset_right) {
180 util::CheckAlignment<uint32_t>(left_base);

Callers

nothing calls this directly

Calls 5

CeilDivFunction · 0.85
SafeLoadFunction · 0.85
has_avx2Method · 0.80
GetBitFunction · 0.50
metadataMethod · 0.45

Tested by

no test coverage detected