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

Method NullUpdateColumnToRow

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

Source from the content-addressed store, hash-verified

33
34template <bool use_selection>
35void KeyCompare::NullUpdateColumnToRow(uint32_t id_col, uint32_t num_rows_to_compare,
36 const uint16_t* sel_left_maybe_null,
37 const uint32_t* left_to_right_map,
38 LightContext* ctx, const KeyColumnArray& col,
39 const RowTableImpl& rows,
40 bool are_cols_in_encoding_order,
41 uint8_t* match_bytevector) {
42 if (!rows.has_any_nulls(ctx) && !col.data(0)) {
43 return;
44 }
45 uint32_t num_processed = 0;
46#if defined(ARROW_HAVE_RUNTIME_AVX2)
47 if (ctx->has_avx2()) {
48 num_processed = NullUpdateColumnToRow_avx2(
49 use_selection, id_col, num_rows_to_compare, sel_left_maybe_null,
50 left_to_right_map, ctx, col, rows, are_cols_in_encoding_order, match_bytevector);
51 }
52#endif
53
54 const uint32_t null_bit_id =
55 ColIdInEncodingOrder(rows, id_col, are_cols_in_encoding_order);
56
57 if (!col.data(0)) {
58 // Remove rows from the result for which the column value is a null
59 for (uint32_t i = num_processed; i < num_rows_to_compare; ++i) {
60 uint32_t irow_left = use_selection ? sel_left_maybe_null[i] : i;
61 uint32_t irow_right = left_to_right_map[irow_left];
62 match_bytevector[i] &= (rows.is_null(irow_right, null_bit_id) ? 0 : 0xff);
63 }
64 } else if (!rows.has_any_nulls(ctx)) {
65 // Remove rows from the result for which the column value on left side is
66 // null
67 const uint8_t* non_nulls = col.data(0);
68 ARROW_DCHECK(non_nulls);
69 for (uint32_t i = num_processed; i < num_rows_to_compare; ++i) {
70 uint32_t irow_left = use_selection ? sel_left_maybe_null[i] : i;
71 match_bytevector[i] &=
72 bit_util::GetBit(non_nulls, irow_left + col.bit_offset(0)) ? 0xff : 0;
73 }
74 } else {
75 const uint8_t* non_nulls = col.data(0);
76 ARROW_DCHECK(non_nulls);
77 for (uint32_t i = num_processed; i < num_rows_to_compare; ++i) {
78 uint32_t irow_left = use_selection ? sel_left_maybe_null[i] : i;
79 uint32_t irow_right = left_to_right_map[irow_left];
80 int right_null = rows.is_null(irow_right, null_bit_id) ? 0xff : 0;
81 int left_null =
82 bit_util::GetBit(non_nulls, irow_left + col.bit_offset(0)) ? 0 : 0xff;
83 match_bytevector[i] |= left_null & right_null;
84 match_bytevector[i] &= ~(left_null ^ right_null);
85 }
86 }
87}
88
89template <bool use_selection, class COMPARE_FN>
90void KeyCompare::CompareBinaryColumnToRowHelper(

Callers

nothing calls this directly

Calls 5

has_any_nullsMethod · 0.80
has_avx2Method · 0.80
is_nullMethod · 0.80
GetBitFunction · 0.50
dataMethod · 0.45

Tested by

no test coverage detected