MCPcopy Create free account
hub / github.com/apache/arrow / LoadFieldsSubset

Method LoadFieldsSubset

cpp/src/arrow/ipc/reader.cc:1369–1392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls 7

IOErrorFunction · 0.85
SkipFieldMethod · 0.80
OKFunction · 0.50
num_fieldsMethod · 0.45
fieldMethod · 0.45
LoadMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected