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

Method DecodeNulls

cpp/src/arrow/compute/row/row_encoder_internal.cc:33–63  ·  view source on GitHub ↗

extract the null bitmap from the leading nullity bytes of encoded keys

Source from the content-addressed store, hash-verified

31
32// extract the null bitmap from the leading nullity bytes of encoded keys
33Status KeyEncoder::DecodeNulls(MemoryPool* pool, int32_t length, uint8_t** encoded_bytes,
34 std::shared_ptr<Buffer>* null_bitmap,
35 int32_t* null_count) {
36 // first count nulls to determine if a null bitmap is necessary
37 *null_count = 0;
38 for (int32_t i = 0; i < length; ++i) {
39 *null_count += (encoded_bytes[i][0] == kNullByte);
40 }
41
42 if (*null_count > 0) {
43 ARROW_ASSIGN_OR_RAISE(*null_bitmap, AllocateBitmap(length, pool));
44 uint8_t* validity = (*null_bitmap)->mutable_data();
45
46 FirstTimeBitmapWriter writer(validity, 0, length);
47 for (int32_t i = 0; i < length; ++i) {
48 if (encoded_bytes[i][0] == kValidByte) {
49 writer.Set();
50 } else {
51 writer.Clear();
52 }
53 writer.Next();
54 encoded_bytes[i] += 1;
55 }
56 writer.Finish();
57 } else {
58 for (int32_t i = 0; i < length; ++i) {
59 encoded_bytes[i] += 1;
60 }
61 }
62 return Status ::OK();
63}
64
65void BooleanKeyEncoder::AddLength(const ExecValue&, int64_t batch_length,
66 int32_t* lengths) {

Callers

nothing calls this directly

Calls 8

AllocateBitmapFunction · 0.85
ARROW_ASSIGN_OR_RAISEFunction · 0.50
OKFunction · 0.50
mutable_dataMethod · 0.45
SetMethod · 0.45
ClearMethod · 0.45
NextMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected