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

Method Encode

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

Source from the content-addressed store, hash-verified

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

Callers 3

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 1

TESTFunction · 0.36