| 88 | |
| 89 | template <bool use_selection, class COMPARE_FN> |
| 90 | void KeyCompare::CompareBinaryColumnToRowHelper( |
| 91 | uint32_t offset_within_row, uint32_t first_row_to_compare, |
| 92 | uint32_t num_rows_to_compare, const uint16_t* sel_left_maybe_null, |
| 93 | const uint32_t* left_to_right_map, LightContext* ctx, const KeyColumnArray& col, |
| 94 | const RowTableImpl& rows, uint8_t* match_bytevector, COMPARE_FN compare_fn) { |
| 95 | bool is_fixed_length = rows.metadata().is_fixed_length; |
| 96 | if (is_fixed_length) { |
| 97 | uint32_t fixed_length = rows.metadata().fixed_length; |
| 98 | const uint8_t* rows_left = col.data(1); |
| 99 | const uint8_t* rows_right = rows.fixed_length_rows(/*row_id=*/0); |
| 100 | for (uint32_t i = first_row_to_compare; i < num_rows_to_compare; ++i) { |
| 101 | uint32_t irow_left = use_selection ? sel_left_maybe_null[i] : i; |
| 102 | // irow_right is used to index into row data so promote to the row offset type. |
| 103 | RowTableImpl::offset_type irow_right = left_to_right_map[irow_left]; |
| 104 | RowTableImpl::offset_type offset_right = |
| 105 | irow_right * fixed_length + offset_within_row; |
| 106 | match_bytevector[i] = compare_fn(rows_left, rows_right, irow_left, offset_right); |
| 107 | } |
| 108 | } else { |
| 109 | const uint8_t* rows_left = col.data(1); |
| 110 | const RowTableImpl::offset_type* offsets_right = rows.offsets(); |
| 111 | const uint8_t* rows_right = rows.var_length_rows(); |
| 112 | for (uint32_t i = first_row_to_compare; i < num_rows_to_compare; ++i) { |
| 113 | uint32_t irow_left = use_selection ? sel_left_maybe_null[i] : i; |
| 114 | uint32_t irow_right = left_to_right_map[irow_left]; |
| 115 | RowTableImpl::offset_type offset_right = |
| 116 | offsets_right[irow_right] + offset_within_row; |
| 117 | match_bytevector[i] = compare_fn(rows_left, rows_right, irow_left, offset_right); |
| 118 | } |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | template <bool use_selection> |
| 123 | void KeyCompare::CompareBinaryColumnToRow(uint32_t offset_within_row, |