niyue commented on a change in pull request #11486:
URL: https://github.com/apache/arrow/pull/11486#discussion_r732845782
##########
File path: cpp/src/arrow/ipc/reader.cc
##########
@@ -1070,7 +1096,19 @@ class RecordBatchFileReaderImpl : public
RecordBatchFileReader {
read_dictionaries_ = true;
}
- ARROW_ASSIGN_OR_RAISE(auto message,
ReadMessageFromBlock(GetRecordBatchBlock(i)));
+ FieldsLoaderFunction fields_loader = {};
+ if (!field_inclusion_mask_.empty()) {
+ auto& schema = schema_;
+ auto& inclusion_mask = field_inclusion_mask_;
+ auto& read_options = options_;
+ fields_loader = [schema, inclusion_mask, read_options](
+ const flatbuf::RecordBatch* metadata,
+ io::RandomAccessFile* file) {
+ return LoadFieldsSubset(metadata, read_options, file, schema,
&inclusion_mask);
+ };
+ }
+ ARROW_ASSIGN_OR_RAISE(auto message,
+ ReadMessageFromBlock(GetRecordBatchBlock(i),
fields_loader));
Review comment:
The `fields_loader` is passed as lambda to the bottom layer (message.cc)
so that we don't have to duplicate the code of `ArrayLoader` both in
`message.cc` and `reader.cc`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]