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

Function ToChunked

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

Source from the content-addressed store, hash-verified

467}
468
469static std::shared_ptr<ChunkedArray> ToChunked(const std::shared_ptr<Array>& array,
470 double chunk_proportion = 1.0) {
471 auto struct_array = internal::checked_pointer_cast<StructArray>(array);
472 const auto num_rows = struct_array->length();
473 const auto chunk_length = static_cast<int64_t>(std::ceil(num_rows * chunk_proportion));
474
475 ArrayVector chunks;
476 for (int64_t offset = 0; offset < num_rows;) {
477 int64_t slice_length = std::min(chunk_length, num_rows - offset);
478 chunks.push_back(*struct_array->SliceSafe(offset, slice_length));
479 offset += slice_length;
480 }
481
482 return *ChunkedArray::Make(std::move(chunks));
483}
484
485static std::shared_ptr<Table> ToTable(const std::shared_ptr<Array>& array,
486 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