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

Method AppendValues

cpp/src/arrow/array/builder_binary.h:191–217  ·  view source on GitHub ↗

\brief Append a sequence of strings in one shot. \param[in] values a vector of strings \param[in] valid_bytes an optional sequence of bytes where non-zero indicates a valid (non-null) value \return Status

Source from the content-addressed store, hash-verified

189 /// indicates a valid (non-null) value
190 /// \return Status
191 Status AppendValues(const std::vector<std::string>& values,
192 const uint8_t* valid_bytes = NULLPTR) {
193 std::size_t total_length = std::accumulate(
194 values.begin(), values.end(), 0ULL,
195 [](uint64_t sum, const std::string& str) { return sum + str.size(); });
196 ARROW_RETURN_NOT_OK(Reserve(values.size()));
197 ARROW_RETURN_NOT_OK(ReserveData(total_length));
198
199 if (valid_bytes != NULLPTR) {
200 for (std::size_t i = 0; i < values.size(); ++i) {
201 UnsafeAppendNextOffset();
202 if (valid_bytes[i]) {
203 value_data_builder_.UnsafeAppend(
204 reinterpret_cast<const uint8_t*>(values[i].data()), values[i].size());
205 }
206 }
207 } else {
208 for (const auto& value : values) {
209 UnsafeAppendNextOffset();
210 value_data_builder_.UnsafeAppend(reinterpret_cast<const uint8_t*>(value.data()),
211 value.size());
212 }
213 }
214
215 UnsafeAppendToBitmap(valid_bytes, values.size());
216 return Status::OK();
217 }
218
219 /// \brief Append a sequence of nul-terminated strings in one shot.
220 /// If one of the values is NULL, it is processed as a null

Callers

nothing calls this directly

Calls 9

ReserveDataFunction · 0.85
UnsafeAppendToBitmapFunction · 0.85
ReserveFunction · 0.70
OKFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
UnsafeAppendMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected