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