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

Method EncodeSelectedImp

cpp/src/arrow/compute/row/encode_internal.cc:335–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

333
334template <class COPY_FN, class SET_NULL_FN>
335void EncoderBinary::EncodeSelectedImp(uint32_t offset_within_row, RowTableImpl* rows,
336 const KeyColumnArray& col, uint32_t num_selected,
337 const uint16_t* selection, COPY_FN copy_fn,
338 SET_NULL_FN set_null_fn) {
339 bool is_fixed_length = rows->metadata().is_fixed_length;
340 if (is_fixed_length) {
341 uint32_t row_width = rows->metadata().fixed_length;
342 const uint8_t* src_base = col.data(1);
343 uint8_t* dst = rows->mutable_fixed_length_rows(/*row_id=*/0) + offset_within_row;
344 for (uint32_t i = 0; i < num_selected; ++i) {
345 copy_fn(dst, src_base, selection[i]);
346 dst += row_width;
347 }
348 if (col.data(0)) {
349 const uint8_t* non_null_bits = col.data(0);
350 dst = rows->mutable_fixed_length_rows(/*row_id=*/0) + offset_within_row;
351 for (uint32_t i = 0; i < num_selected; ++i) {
352 bool is_null = !bit_util::GetBit(non_null_bits, selection[i] + col.bit_offset(0));
353 if (is_null) {
354 set_null_fn(dst);
355 }
356 dst += row_width;
357 }
358 }
359 } else {
360 const uint8_t* src_base = col.data(1);
361 uint8_t* dst = rows->mutable_var_length_rows() + offset_within_row;
362 const RowTableImpl::offset_type* offsets = rows->offsets();
363 for (uint32_t i = 0; i < num_selected; ++i) {
364 copy_fn(dst + offsets[i], src_base, selection[i]);
365 }
366 if (col.data(0)) {
367 const uint8_t* non_null_bits = col.data(0);
368 uint8_t* dst = rows->mutable_var_length_rows() + offset_within_row;
369 const RowTableImpl::offset_type* offsets = rows->offsets();
370 for (uint32_t i = 0; i < num_selected; ++i) {
371 bool is_null = !bit_util::GetBit(non_null_bits, selection[i] + col.bit_offset(0));
372 if (is_null) {
373 set_null_fn(dst + offsets[i]);
374 }
375 }
376 }
377 }
378}
379
380void EncoderBinary::EncodeSelected(uint32_t offset_within_row, RowTableImpl* rows,
381 const KeyColumnArray& col, uint32_t num_selected,

Callers

nothing calls this directly

Calls 5

GetBitFunction · 0.50
metadataMethod · 0.45
dataMethod · 0.45
offsetsMethod · 0.45

Tested by

no test coverage detected