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

Method AppendValues

cpp/src/arrow/array/builder_binary.h:193–219  ·  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

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