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

Method GetRecordBatchGenerator

cpp/src/parquet/arrow/reader.cc:1213–1453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1211};
1212
1213::arrow::Result<::arrow::AsyncGenerator<std::shared_ptr<::arrow::RecordBatch>>>
1214FileReaderImpl::GetRecordBatchGenerator(std::shared_ptr<FileReader> reader,
1215 const std::vector<int> row_group_indices,
1216 const std::vector<int> column_indices,
1217 ::arrow::internal::Executor* cpu_executor,
1218 int64_t rows_to_readahead) {
1219 RETURN_NOT_OK(BoundsCheck(row_group_indices, column_indices));
1220 if (rows_to_readahead < 0) {
1221 return Status::Invalid("rows_to_readahead must be >= 0");
1222 }
1223 if (reader_properties_.pre_buffer()) {
1224 BEGIN_PARQUET_CATCH_EXCEPTIONS
1225 reader_->PreBuffer(row_group_indices, column_indices, reader_properties_.io_context(),
1226 reader_properties_.cache_options());
1227 END_PARQUET_CATCH_EXCEPTIONS
1228 }
1229 ::arrow::AsyncGenerator<RowGroupGenerator::RecordBatchGenerator> row_group_generator =
1230 RowGroupGenerator(::arrow::internal::checked_pointer_cast<FileReaderImpl>(reader),
1231 cpu_executor, row_group_indices, column_indices,
1232 rows_to_readahead);
1233 ::arrow::AsyncGenerator<std::shared_ptr<::arrow::RecordBatch>> concatenated =
1234 ::arrow::MakeConcatenatedGenerator(std::move(row_group_generator));
1235 WRAP_ASYNC_GENERATOR(std::move(concatenated));
1236 return concatenated;
1237}
1238
1239Status FileReaderImpl::GetColumn(int i, FileColumnIteratorFactory iterator_factory,
1240 std::unique_ptr<ColumnReader>* out) {
1241 RETURN_NOT_OK(BoundsCheckColumn(i));
1242 auto ctx = std::make_shared<ReaderContext>();
1243 ctx->reader = reader_.get();
1244 ctx->pool = pool_;
1245 ctx->iterator_factory = iterator_factory;
1246 ctx->filter_leaves = false;
1247 ctx->reader_properties = &reader_properties_;
1248 std::unique_ptr<ColumnReaderImpl> result;
1249 RETURN_NOT_OK(GetReader(manifest_.schema_fields[i], ctx, &result));
1250 *out = std::move(result);
1251 return Status::OK();
1252}
1253
1254Result<std::shared_ptr<Table>> FileReaderImpl::ReadRowGroups(
1255 const std::vector<int>& row_groups, const std::vector<int>& column_indices) {
1256 RETURN_NOT_OK(BoundsCheck(row_groups, column_indices));
1257
1258 // PARQUET-1698/PARQUET-1820: pre-buffer row groups/column chunks if enabled
1259 if (reader_properties_.pre_buffer()) {
1260 BEGIN_PARQUET_CATCH_EXCEPTIONS
1261 parquet_reader()->PreBuffer(row_groups, column_indices,
1262 reader_properties_.io_context(),
1263 reader_properties_.cache_options());
1264 END_PARQUET_CATCH_EXCEPTIONS
1265 }
1266
1267 auto fut = DecodeRowGroups(/*self=*/nullptr, row_groups, column_indices,
1268 /*cpu_executor=*/nullptr);
1269 return fut.MoveResult();
1270}

Callers

nothing calls this directly

Calls 4

BoundsCheckFunction · 0.85
RowGroupGeneratorClass · 0.85
InvalidFunction · 0.50

Tested by

no test coverage detected