| 694 | }; |
| 695 | |
| 696 | Result<std::shared_ptr<RecordBatch>> LoadRecordBatchSubset( |
| 697 | const flatbuf::RecordBatch* metadata, const std::shared_ptr<Schema>& schema, |
| 698 | const std::vector<bool>* inclusion_mask, const IpcReadContext& context, |
| 699 | io::RandomAccessFile* file) { |
| 700 | ArrayLoader loader(metadata, context.metadata_version, context.options, file); |
| 701 | ArrayDataVector columns(schema->num_fields()); |
| 702 | |
| 703 | for (int i = 0; i < schema->num_fields(); ++i) { |
| 704 | const Field& field = *schema->field(i); |
| 705 | if (!inclusion_mask || (*inclusion_mask)[i]) { |
| 706 | // Read field |
| 707 | auto column = std::make_shared<ArrayData>(); |
| 708 | RETURN_NOT_OK(loader.Load(&field, column.get())); |
| 709 | if (metadata->length() != column->length) { |
| 710 | return Status::IOError("Array length did not match record batch length"); |
| 711 | } |
| 712 | columns[i] = std::move(column); |
| 713 | } else { |
| 714 | // Skip field. This logic must be executed to advance the state of the |
| 715 | // loader to the next field |
| 716 | RETURN_NOT_OK(loader.SkipField(&field)); |
| 717 | } |
| 718 | } |
| 719 | |
| 720 | RecordBatchLoader batch_loader{context, schema, metadata->length(), |
| 721 | inclusion_mask ? *inclusion_mask : std::vector<bool>{}}; |
| 722 | return batch_loader.CreateRecordBatch(std::move(columns)); |
| 723 | } |
| 724 | |
| 725 | Result<std::shared_ptr<RecordBatch>> LoadRecordBatch( |
| 726 | const flatbuf::RecordBatch* metadata, const std::shared_ptr<Schema>& schema, |
no test coverage detected