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

Function ProcessJsonArrayElements

cpp/src/arrow/json/from_string.cc:276–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274
275template <size_t kExpectedSize>
276Status ProcessJsonArrayElements(
277 sj::array& json_array, const char* error_context,
278 const std::array<JsonElementHandler, kExpectedSize>& handlers) {
279 auto it = json_array.begin();
280 auto end = json_array.end();
281
282 size_t index = 0;
283 for (const auto& handler : handlers) {
284 if (it == end) {
285 return Status::Invalid(error_context, " must have exactly ", kExpectedSize,
286 " elements, had ", index);
287 }
288
289 ARROW_ASSIGN_OR_RAISE(sj::value element,
290 internal::ResolveSimdjsonResult<sj::value>(
291 *it, "Could not iterate elements of JSON array: "));
292 RETURN_NOT_OK(handler(element));
293 ++it;
294 ++index;
295 }
296
297 if (it != end) {
298 return Status::Invalid(error_context, " must have exactly ", kExpectedSize,
299 " elements, had more");
300 }
301 return Status::OK();
302}
303
304// ------------------------------------------------------------------------
305// Converter for int arrays

Callers

nothing calls this directly

Calls 5

OKFunction · 0.70
InvalidFunction · 0.50
handlerFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected