| 510 | conversion_schema(std::move(conversion_schema)) {} |
| 511 | |
| 512 | Result<std::shared_ptr<RecordBatch>> DecodedArraysToBatch( |
| 513 | std::vector<std::shared_ptr<Array>> arrays) { |
| 514 | const auto n_rows = arrays[0]->length(); |
| 515 | |
| 516 | if (schema == nullptr) { |
| 517 | FieldVector fields(arrays.size()); |
| 518 | for (size_t i = 0; i < arrays.size(); ++i) { |
| 519 | fields[i] = field(conversion_schema.columns[i].name, arrays[i]->type()); |
| 520 | } |
| 521 | |
| 522 | if (n_rows == 0) { |
| 523 | // No rows so schema is not reliable. return RecordBatch but do not set schema |
| 524 | return RecordBatch::Make(arrow::schema(std::move(fields)), n_rows, |
| 525 | std::move(arrays)); |
| 526 | } |
| 527 | |
| 528 | schema = arrow::schema(std::move(fields)); |
| 529 | } |
| 530 | |
| 531 | return RecordBatch::Make(schema, n_rows, std::move(arrays)); |
| 532 | } |
| 533 | |
| 534 | // Make column decoders from conversion schema |
| 535 | Status MakeColumnDecoders(io::IOContext io_context) { |