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

Method AppendScalar

cpp/src/arrow/array/builder_run_end.cc:96–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96Status RunCompressorBuilder::AppendScalar(const Scalar& scalar, int64_t n_repeats) {
97 if (ARROW_PREDICT_FALSE(n_repeats == 0)) {
98 return Status::OK();
99 }
100 if (ARROW_PREDICT_FALSE(current_run_length_ == 0)) {
101 // Open a new run
102 current_value_ = scalar.is_valid ? scalar.shared_from_this() : NULLPTR;
103 current_run_length_ = n_repeats;
104 } else if ((current_value_ == NULLPTR && !scalar.is_valid) ||
105 (current_value_ != NULLPTR && current_value_->Equals(scalar))) {
106 // Extend the currently open run
107 current_run_length_ += n_repeats;
108 } else {
109 // Close the current run
110 ARROW_RETURN_NOT_OK(WillCloseRun(current_value_, current_run_length_));
111 ARROW_RETURN_NOT_OK(current_value_ ? inner_builder_->AppendScalar(*current_value_)
112 : inner_builder_->AppendNull());
113 UpdateDimensions();
114 // Open a new run
115 current_value_ = scalar.is_valid ? scalar.shared_from_this() : NULLPTR;
116 current_run_length_ = n_repeats;
117 }
118 return Status::OK();
119}
120
121Status RunCompressorBuilder::AppendScalars(const ScalarVector& scalars) {
122 if (scalars.empty()) {

Callers 2

AppendNullsMethod · 0.45
FinishCurrentRunMethod · 0.45

Calls 6

open_run_lengthMethod · 0.80
AppendScalarFunction · 0.70
OKFunction · 0.50
EqualsMethod · 0.45
AppendNullMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected