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

Method GetRecordBatchGenerator

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

Source from the content-addressed store, hash-verified

1260};
1261
1262::arrow::Result<::arrow::AsyncGenerator<std::shared_ptr<::arrow::RecordBatch>>>
1263FileReaderImpl::GetRecordBatchGenerator(std::shared_ptr<FileReader> reader,
1264 const std::vector<int> row_group_indices,
1265 const std::vector<int> column_indices,
1266 ::arrow::internal::Executor* cpu_executor,
1267 int64_t rows_to_readahead) {
1268 RETURN_NOT_OK(BoundsCheck(row_group_indices, column_indices));
1269 if (rows_to_readahead < 0) {
1270 return Status::Invalid("rows_to_readahead must be >= 0");
1271 }
1272 if (reader_properties_.pre_buffer()) {
1273 BEGIN_PARQUET_CATCH_EXCEPTIONS
1274 reader_->PreBuffer(row_group_indices, column_indices, reader_properties_.io_context(),
1275 reader_properties_.cache_options());
1276 END_PARQUET_CATCH_EXCEPTIONS
1277 }
1278 ::arrow::AsyncGenerator<RowGroupGenerator::RecordBatchGenerator> row_group_generator =
1279 RowGroupGenerator(::arrow::internal::checked_pointer_cast<FileReaderImpl>(reader),
1280 cpu_executor, row_group_indices, column_indices,
1281 rows_to_readahead);
1282 ::arrow::AsyncGenerator<std::shared_ptr<::arrow::RecordBatch>> concatenated =
1283 ::arrow::MakeConcatenatedGenerator(std::move(row_group_generator));
1284 WRAP_ASYNC_GENERATOR(std::move(concatenated));
1285 return concatenated;
1286}
1287
1288Status FileReaderImpl::GetColumn(int i, FileColumnIteratorFactory iterator_factory,
1289 std::unique_ptr<ColumnReader>* out) {
1290 RETURN_NOT_OK(BoundsCheckColumn(i));
1291 auto ctx = std::make_shared<ReaderContext>();
1292 ctx->reader = reader_.get();
1293 ctx->pool = pool_;
1294 ctx->iterator_factory = iterator_factory;
1295 ctx->filter_leaves = false;
1296 ctx->reader_properties = &reader_properties_;
1297 std::unique_ptr<ColumnReaderImpl> result;
1298 RETURN_NOT_OK(GetReader(manifest_.schema_fields[i], ctx, &result));
1299 *out = std::move(result);
1300 return Status::OK();
1301}
1302
1303Result<std::shared_ptr<Table>> FileReaderImpl::ReadRowGroups(
1304 const std::vector<int>& row_groups, const std::vector<int>& column_indices) {
1305 RETURN_NOT_OK(BoundsCheck(row_groups, column_indices));
1306
1307 // PARQUET-1698/PARQUET-1820: pre-buffer row groups/column chunks if enabled
1308 if (reader_properties_.pre_buffer()) {
1309 BEGIN_PARQUET_CATCH_EXCEPTIONS
1310 parquet_reader()->PreBuffer(row_groups, column_indices,
1311 reader_properties_.io_context(),
1312 reader_properties_.cache_options());
1313 END_PARQUET_CATCH_EXCEPTIONS
1314 }
1315
1316 auto fut = DecodeRowGroups(/*self=*/nullptr, row_groups, column_indices,
1317 /*cpu_executor=*/nullptr);
1318 return fut.MoveResult();
1319}

Callers

nothing calls this directly

Calls 4

BoundsCheckFunction · 0.85
RowGroupGeneratorClass · 0.85
InvalidFunction · 0.50

Tested by

no test coverage detected