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

Method ToStructArray

cpp/src/arrow/record_batch.cc:282–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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