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

Method Encode

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

Source from the content-addressed store, hash-verified

75}
76
77Status BooleanKeyEncoder::Encode(const ExecValue& data, int64_t batch_length,
78 uint8_t** encoded_bytes) {
79 auto handle_next_valid_value = [&encoded_bytes](bool value) {
80 auto& encoded_ptr = *encoded_bytes++;
81 *encoded_ptr++ = kValidByte;
82 *encoded_ptr++ = value;
83 };
84 auto handle_next_null_value = [&encoded_bytes]() {
85 auto& encoded_ptr = *encoded_bytes++;
86 *encoded_ptr++ = kNullByte;
87 *encoded_ptr++ = 0;
88 };
89
90 if (data.is_array()) {
91 VisitArraySpanInline<BooleanType>(data.array, handle_next_valid_value,
92 handle_next_null_value);
93 } else {
94 const auto& scalar = data.scalar_as<BooleanScalar>();
95 if (!scalar.is_valid) {
96 for (int64_t i = 0; i < batch_length; i++) {
97 handle_next_null_value();
98 }
99 } else {
100 const bool value = scalar.value;
101 for (int64_t i = 0; i < batch_length; i++) {
102 handle_next_valid_value(value);
103 }
104 }
105 }
106 return Status::OK();
107}
108
109void BooleanKeyEncoder::EncodeNull(uint8_t** encoded_bytes) {
110 auto& encoded_ptr = *encoded_bytes;

Callers 4

TESTFunction · 0.45
EncodeAndAppendMethod · 0.45
ConsumeImplMethod · 0.45

Calls 13

fixed_size_binaryFunction · 0.85
EncodeFunction · 0.85
is_arrayMethod · 0.80
OKFunction · 0.50
NotImplementedFunction · 0.50
ExecValueClass · 0.50
dataMethod · 0.45
getMethod · 0.45
viewMethod · 0.45
sizeMethod · 0.45
ToArrayMethod · 0.45
dictionaryMethod · 0.45

Tested by 2

TESTFunction · 0.36