@@ -36,22 +36,22 @@ void KeyCompare::NullUpdateColumnToRow(uint32_t id_col, uint32_t num_rows_to_com
3636 const uint32_t * left_to_right_map,
3737 LightContext* ctx, const KeyColumnArray& col,
3838 const RowTableImpl& rows,
39- uint8_t * match_bytevector ,
40- bool are_cols_in_encoding_order ) {
39+ bool are_cols_in_encoding_order ,
40+ uint8_t * match_bytevector ) {
4141 if (!rows.has_any_nulls (ctx) && !col.data (0 )) {
4242 return ;
4343 }
4444 uint32_t num_processed = 0 ;
4545#if defined(ARROW_HAVE_RUNTIME_AVX2)
4646 if (ctx->has_avx2 ()) {
47- num_processed = NullUpdateColumnToRow_avx2 (use_selection, id_col, num_rows_to_compare,
48- sel_left_maybe_null, left_to_right_map ,
49- ctx, col, rows, match_bytevector);
47+ num_processed = NullUpdateColumnToRow_avx2 (
48+ use_selection, id_col, num_rows_to_compare, sel_left_maybe_null ,
49+ left_to_right_map, ctx, col, rows, are_cols_in_encoding_order , match_bytevector);
5050 }
5151#endif
5252
53- uint32_t null_bit_id =
54- are_cols_in_encoding_order ? id_col : rows. metadata (). pos_after_encoding (id_col );
53+ const uint32_t null_bit_id =
54+ ColIdInEncodingOrder (rows, id_col, are_cols_in_encoding_order );
5555
5656 if (!col.data (0 )) {
5757 // Remove rows from the result for which the column value is a null
@@ -363,10 +363,9 @@ void KeyCompare::CompareColumnsToRows(
363363 continue ;
364364 }
365365
366- uint32_t offset_within_row = rows.metadata ().encoded_field_offset (
367- are_cols_in_encoding_order
368- ? static_cast <uint32_t >(icol)
369- : rows.metadata ().pos_after_encoding (static_cast <uint32_t >(icol)));
366+ uint32_t offset_within_row =
367+ rows.metadata ().encoded_field_offset (ColIdInEncodingOrder (
368+ rows, static_cast <uint32_t >(icol), are_cols_in_encoding_order));
370369 if (col.metadata ().is_fixed_length ) {
371370 if (sel_left_maybe_null) {
372371 CompareBinaryColumnToRow<true >(
@@ -375,9 +374,8 @@ void KeyCompare::CompareColumnsToRows(
375374 is_first_column ? match_bytevector_A : match_bytevector_B);
376375 NullUpdateColumnToRow<true >(
377376 static_cast <uint32_t >(icol), num_rows_to_compare, sel_left_maybe_null,
378- left_to_right_map, ctx, col, rows,
379- is_first_column ? match_bytevector_A : match_bytevector_B,
380- are_cols_in_encoding_order);
377+ left_to_right_map, ctx, col, rows, are_cols_in_encoding_order,
378+ is_first_column ? match_bytevector_A : match_bytevector_B);
381379 } else {
382380 // Version without using selection vector
383381 CompareBinaryColumnToRow<false >(
@@ -386,9 +384,8 @@ void KeyCompare::CompareColumnsToRows(
386384 is_first_column ? match_bytevector_A : match_bytevector_B);
387385 NullUpdateColumnToRow<false >(
388386 static_cast <uint32_t >(icol), num_rows_to_compare, sel_left_maybe_null,
389- left_to_right_map, ctx, col, rows,
390- is_first_column ? match_bytevector_A : match_bytevector_B,
391- are_cols_in_encoding_order);
387+ left_to_right_map, ctx, col, rows, are_cols_in_encoding_order,
388+ is_first_column ? match_bytevector_A : match_bytevector_B);
392389 }
393390 if (!is_first_column) {
394391 AndByteVectors (ctx, num_rows_to_compare, match_bytevector_A, match_bytevector_B);
@@ -414,9 +411,8 @@ void KeyCompare::CompareColumnsToRows(
414411 }
415412 NullUpdateColumnToRow<true >(
416413 static_cast <uint32_t >(icol), num_rows_to_compare, sel_left_maybe_null,
417- left_to_right_map, ctx, col, rows,
418- is_first_column ? match_bytevector_A : match_bytevector_B,
419- are_cols_in_encoding_order);
414+ left_to_right_map, ctx, col, rows, are_cols_in_encoding_order,
415+ is_first_column ? match_bytevector_A : match_bytevector_B);
420416 } else {
421417 if (ivarbinary == 0 ) {
422418 CompareVarBinaryColumnToRow<false , true >(
@@ -429,9 +425,8 @@ void KeyCompare::CompareColumnsToRows(
429425 }
430426 NullUpdateColumnToRow<false >(
431427 static_cast <uint32_t >(icol), num_rows_to_compare, sel_left_maybe_null,
432- left_to_right_map, ctx, col, rows,
433- is_first_column ? match_bytevector_A : match_bytevector_B,
434- are_cols_in_encoding_order);
428+ left_to_right_map, ctx, col, rows, are_cols_in_encoding_order,
429+ is_first_column ? match_bytevector_A : match_bytevector_B);
435430 }
436431 if (!is_first_column) {
437432 AndByteVectors (ctx, num_rows_to_compare, match_bytevector_A, match_bytevector_B);
0 commit comments