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

Method ToStructArray

cpp/src/arrow/record_batch.cc:283–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281} // namespace
282
283Result<std::shared_ptr<StructArray>> RecordBatch::ToStructArray() const {
284 if (num_columns() != 0) {
285 // Only check the first column because `StructArray::Make` already checks that the
286 // child lengths are equal.
287 RETURN_NOT_OK(ValidateColumnLength(*this, 0));
288 return StructArray::Make(columns(), schema()->fields());
289 }
290 return std::make_shared<StructArray>(arrow::struct_({}), num_rows_,
291 std::vector<std::shared_ptr<Array>>{},
292 /*null_bitmap=*/nullptr,
293 /*null_count=*/0,
294 /*offset=*/0);
295}
296
297Result<std::shared_ptr<Tensor>> RecordBatch::ToTensor(bool null_to_nan, bool row_major,
298 MemoryPool* pool) const {

Callers 2

TEST_FFunction · 0.80
GetEmptySegmentKeyOutputFunction · 0.80

Calls 7

ValidateColumnLengthFunction · 0.85
columnsFunction · 0.85
struct_Function · 0.85
num_columnsFunction · 0.70
MakeFunction · 0.70
schemaFunction · 0.70
fieldsMethod · 0.45

Tested by 2

TEST_FFunction · 0.64
GetEmptySegmentKeyOutputFunction · 0.64