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

Function LogicalNullCount

cpp/src/arrow/util/dict_util.cc:33–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31
32template <typename IndexArrowType>
33int64_t LogicalNullCount(const ArraySpan& span) {
34 const auto* indices_valid_bitmap = span.buffers[0].data;
35 const auto& dictionary_span = span.dictionary();
36 const auto* dictionary_valid_bitmap = dictionary_span.buffers[0].data;
37
38 using CType = typename IndexArrowType::c_type;
39 const CType* indices_data = span.GetValues<CType>(1);
40 int64_t null_count = 0;
41 DCHECK_OK(internal::VisitBitRuns(
42 indices_valid_bitmap, span.offset, span.length,
43 [=, &null_count](int64_t position, int64_t length, bool valid) {
44 if (valid) {
45 // This is a run of valid indicies, so we need to look each of them up
46 // in the dictionary array to see if they are null
47 for (int64_t i = position; i < position + length; i++) {
48 CType index = indices_data[i];
49 if (!bit_util::GetBit(dictionary_valid_bitmap,
50 index + dictionary_span.offset)) {
51 null_count++;
52 }
53 }
54 } else {
55 // This is a run of null indices
56 null_count += length;
57 }
58 return Status::OK();
59 }));
60 return null_count;
61}
62
63template <typename IndexArrowType>
64void SetLogicalNullBits(const ArraySpan& span, uint8_t* out_bitmap, int64_t out_offset,

Callers

nothing calls this directly

Calls 7

VisitBitRunsFunction · 0.85
GetNullCountMethod · 0.80
index_typeMethod · 0.80
GetBitFunction · 0.70
OKFunction · 0.50
dictionaryMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected