| 1372 | } |
| 1373 | |
| 1374 | static Status LoadFieldsSubset(const flatbuf::RecordBatch* metadata, |
| 1375 | const IpcReadOptions& options, |
| 1376 | io::RandomAccessFile* file, |
| 1377 | const std::shared_ptr<Schema>& schema, |
| 1378 | const std::vector<bool>* inclusion_mask, |
| 1379 | MetadataVersion metadata_version = MetadataVersion::V5) { |
| 1380 | ArrayLoader loader(metadata, metadata_version, options, file); |
| 1381 | for (int i = 0; i < schema->num_fields(); ++i) { |
| 1382 | const Field& field = *schema->field(i); |
| 1383 | if (!inclusion_mask || (*inclusion_mask)[i]) { |
| 1384 | // Read field |
| 1385 | ArrayData column; |
| 1386 | RETURN_NOT_OK(loader.Load(&field, &column)); |
| 1387 | if (metadata->length() != column.length) { |
| 1388 | return Status::IOError("Array length did not match record batch length"); |
| 1389 | } |
| 1390 | } else { |
| 1391 | // Skip field. This logic must be executed to advance the state of the |
| 1392 | // loader to the next field |
| 1393 | RETURN_NOT_OK(loader.SkipField(&field)); |
| 1394 | } |
| 1395 | } |
| 1396 | return Status::OK(); |
| 1397 | } |
| 1398 | |
| 1399 | Future<std::shared_ptr<RecordBatch>> ReadRecordBatchAsync(int i) { |
| 1400 | DCHECK_GE(i, 0); |