| 709 | }; |
| 710 | |
| 711 | Result<std::shared_ptr<RecordBatch>> LoadRecordBatchSubset( |
| 712 | const flatbuf::RecordBatch* metadata, const std::shared_ptr<Schema>& schema, |
| 713 | const std::vector<bool>* inclusion_mask, const IpcReadContext& context, |
| 714 | io::RandomAccessFile* file) { |
| 715 | ArrayLoader loader(metadata, context.metadata_version, context.options, file); |
| 716 | ArrayDataVector columns(schema->num_fields()); |
| 717 | |
| 718 | for (int i = 0; i < schema->num_fields(); ++i) { |
| 719 | const Field& field = *schema->field(i); |
| 720 | if (!inclusion_mask || (*inclusion_mask)[i]) { |
| 721 | // Read field |
| 722 | auto column = std::make_shared<ArrayData>(); |
| 723 | RETURN_NOT_OK(loader.Load(&field, column.get())); |
| 724 | if (metadata->length() != column->length) { |
| 725 | return Status::IOError("Array length did not match record batch length"); |
| 726 | } |
| 727 | columns[i] = std::move(column); |
| 728 | } else { |
| 729 | // Skip field. This logic must be executed to advance the state of the |
| 730 | // loader to the next field |
| 731 | RETURN_NOT_OK(loader.SkipField(&field)); |
| 732 | } |
| 733 | } |
| 734 | |
| 735 | RecordBatchLoader batch_loader{context, schema, metadata->length(), |
| 736 | inclusion_mask ? *inclusion_mask : std::vector<bool>{}}; |
| 737 | return batch_loader.CreateRecordBatch(std::move(columns)); |
| 738 | } |
| 739 | |
| 740 | Result<std::shared_ptr<RecordBatch>> LoadRecordBatch( |
| 741 | const flatbuf::RecordBatch* metadata, const std::shared_ptr<Schema>& schema, |
no test coverage detected