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

Function ToChunked

cpp/src/arrow/type_benchmark.cc:455–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453}
454
455static std::shared_ptr<ChunkedArray> ToChunked(const std::shared_ptr<Array>& array,
456 double chunk_proportion = 1.0) {
457 auto struct_array = internal::checked_pointer_cast<StructArray>(array);
458 const auto num_rows = struct_array->length();
459 const auto chunk_length = static_cast<int64_t>(std::ceil(num_rows * chunk_proportion));
460
461 ArrayVector chunks;
462 for (int64_t offset = 0; offset < num_rows;) {
463 int64_t slice_length = std::min(chunk_length, num_rows - offset);
464 chunks.push_back(*struct_array->SliceSafe(offset, slice_length));
465 offset += slice_length;
466 }
467
468 return *ChunkedArray::Make(std::move(chunks));
469}
470
471static std::shared_ptr<Table> ToTable(const std::shared_ptr<Array>& array,
472 double chunk_proportion = 1.0) {

Callers 2

ToTableFunction · 0.85

Calls 4

push_backMethod · 0.80
MakeFunction · 0.70
lengthMethod · 0.45
SliceSafeMethod · 0.45

Tested by

no test coverage detected