| 1387 | } |
| 1388 | |
| 1389 | static Status LoadFieldsSubset(const flatbuf::RecordBatch* metadata, |
| 1390 | const IpcReadOptions& options, |
| 1391 | io::RandomAccessFile* file, |
| 1392 | const std::shared_ptr<Schema>& schema, |
| 1393 | const std::vector<bool>* inclusion_mask, |
| 1394 | MetadataVersion metadata_version = MetadataVersion::V5) { |
| 1395 | ArrayLoader loader(metadata, metadata_version, options, file); |
| 1396 | for (int i = 0; i < schema->num_fields(); ++i) { |
| 1397 | const Field& field = *schema->field(i); |
| 1398 | if (!inclusion_mask || (*inclusion_mask)[i]) { |
| 1399 | // Read field |
| 1400 | ArrayData column; |
| 1401 | RETURN_NOT_OK(loader.Load(&field, &column)); |
| 1402 | if (metadata->length() != column.length) { |
| 1403 | return Status::IOError("Array length did not match record batch length"); |
| 1404 | } |
| 1405 | } else { |
| 1406 | // Skip field. This logic must be executed to advance the state of the |
| 1407 | // loader to the next field |
| 1408 | RETURN_NOT_OK(loader.SkipField(&field)); |
| 1409 | } |
| 1410 | } |
| 1411 | return Status::OK(); |
| 1412 | } |
| 1413 | |
| 1414 | Future<std::shared_ptr<RecordBatch>> ReadRecordBatchAsync(int i) { |
| 1415 | DCHECK_GE(i, 0); |