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

Method GetRecordBatchGenerator

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

Source from the content-addressed store, hash-verified

1319};
1320
1321::arrow::Result<::arrow::AsyncGenerator<std::shared_ptr<::arrow::RecordBatch>>>
1322FileReaderImpl::GetRecordBatchGenerator(std::shared_ptr<FileReader> reader,
1323 const std::vector<int> row_group_indices,
1324 const std::vector<int> column_indices,
1325 ::arrow::internal::Executor* cpu_executor,
1326 int64_t rows_to_readahead) {
1327 RETURN_NOT_OK(BoundsCheck(row_group_indices, column_indices));
1328 if (rows_to_readahead < 0) {
1329 return Status::Invalid("rows_to_readahead must be >= 0");
1330 }
1331 if (reader_properties_.pre_buffer()) {
1332 BEGIN_PARQUET_CATCH_EXCEPTIONS
1333 reader_->PreBuffer(row_group_indices, column_indices, reader_properties_.io_context(),
1334 reader_properties_.cache_options());
1335 END_PARQUET_CATCH_EXCEPTIONS
1336 }
1337 ::arrow::AsyncGenerator<RowGroupGenerator::RecordBatchGenerator> row_group_generator =
1338 RowGroupGenerator(::arrow::internal::checked_pointer_cast<FileReaderImpl>(reader),
1339 cpu_executor, row_group_indices, column_indices,
1340 rows_to_readahead);
1341 ::arrow::AsyncGenerator<std::shared_ptr<::arrow::RecordBatch>> concatenated =
1342 ::arrow::MakeConcatenatedGenerator(std::move(row_group_generator));
1343 WRAP_ASYNC_GENERATOR(std::move(concatenated));
1344 return concatenated;
1345}
1346
1347Status FileReaderImpl::GetColumn(int i, FileColumnIteratorFactory iterator_factory,
1348 std::unique_ptr<ColumnReader>* out) {
1349 RETURN_NOT_OK(BoundsCheckColumn(i));
1350 auto ctx = std::make_shared<ReaderContext>();
1351 ctx->reader = reader_.get();
1352 ctx->pool = pool_;
1353 ctx->iterator_factory = iterator_factory;
1354 ctx->filter_leaves = false;
1355 ctx->reader_properties = &reader_properties_;
1356 std::unique_ptr<ColumnReaderImpl> result;
1357 RETURN_NOT_OK(GetReader(manifest_.schema_fields[i], ctx, &result));
1358 *out = std::move(result);
1359 return Status::OK();
1360}
1361
1362Result<std::shared_ptr<Table>> FileReaderImpl::ReadRowGroups(
1363 const std::vector<int>& row_groups, const std::vector<int>& column_indices) {
1364 RETURN_NOT_OK(BoundsCheck(row_groups, column_indices));
1365
1366 // PARQUET-1698/PARQUET-1820: pre-buffer row groups/column chunks if enabled
1367 if (reader_properties_.pre_buffer()) {
1368 BEGIN_PARQUET_CATCH_EXCEPTIONS
1369 parquet_reader()->PreBuffer(row_groups, column_indices,
1370 reader_properties_.io_context(),
1371 reader_properties_.cache_options());
1372 END_PARQUET_CATCH_EXCEPTIONS
1373 }
1374
1375 auto fut = DecodeRowGroups(/*self=*/nullptr, row_groups, column_indices,
1376 /*cpu_executor=*/nullptr);
1377 return fut.MoveResult();
1378}

Callers

nothing calls this directly

Calls 4

BoundsCheckFunction · 0.85
RowGroupGeneratorClass · 0.85
InvalidFunction · 0.50

Tested by

no test coverage detected