Skip to content

Commit

Permalink
resolve comment
Browse files Browse the repository at this point in the history
  • Loading branch information
mapleFU committed Sep 19, 2023
1 parent cfe3b5e commit 5835df3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 6 additions & 3 deletions cpp/src/arrow/dataset/file_parquet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ parquet::ArrowReaderProperties MakeArrowReaderProperties(
}

parquet::ArrowReaderProperties MakeArrowReaderProperties(
const ParquetFileFormat& format, const parquet::FileMetaData& metadata, const ScanOptions& options, const ParquetFragmentScanOptions& parquet_scan_options) {
const ParquetFileFormat& format, const parquet::FileMetaData& metadata,
const ScanOptions& options, const ParquetFragmentScanOptions& parquet_scan_options) {
auto arrow_properties = MakeArrowReaderProperties(format, metadata);
arrow_properties.set_batch_size(options.batch_size);
// Must be set here since the sync ScanTask handles pre-buffering itself
Expand Down Expand Up @@ -455,7 +456,8 @@ Result<std::shared_ptr<parquet::arrow::FileReader>> ParquetFileFormat::GetReader
auto reader = std::move(reader_opt).ValueOrDie();

std::shared_ptr<parquet::FileMetaData> reader_metadata = reader->metadata();
auto arrow_properties = MakeArrowReaderProperties(*this, *reader_metadata, *options, *parquet_scan_options);
auto arrow_properties =
MakeArrowReaderProperties(*this, *reader_metadata, *options, *parquet_scan_options);
std::unique_ptr<parquet::arrow::FileReader> arrow_reader;
RETURN_NOT_OK(parquet::arrow::FileReader::Make(
options->pool, std::move(reader), std::move(arrow_properties), &arrow_reader));
Expand Down Expand Up @@ -488,7 +490,8 @@ Future<std::shared_ptr<parquet::arrow::FileReader>> ParquetFileFormat::GetReader
ARROW_ASSIGN_OR_RAISE(std::unique_ptr<parquet::ParquetFileReader> reader,
reader_fut.MoveResult());
std::shared_ptr<parquet::FileMetaData> metadata = reader->metadata();
auto arrow_properties = MakeArrowReaderProperties(*this, *metadata, *options, *parquet_scan_options);
auto arrow_properties =
MakeArrowReaderProperties(*this, *metadata, *options, *parquet_scan_options);
std::unique_ptr<parquet::arrow::FileReader> arrow_reader;
RETURN_NOT_OK(parquet::arrow::FileReader::Make(options->pool, std::move(reader),
std::move(arrow_properties),
Expand Down
7 changes: 2 additions & 5 deletions cpp/src/arrow/dataset/file_parquet_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -373,18 +373,15 @@ TEST_F(TestParquetFileFormat, SingleThreadExecutor) {
// Reset capacity for io executor
struct PoolResetGuard {
int original_capacity = io::GetIOThreadPoolCapacity();
~PoolResetGuard() {
DCHECK_OK(io::SetIOThreadPoolCapacity(original_capacity));
}
~PoolResetGuard() { DCHECK_OK(io::SetIOThreadPoolCapacity(original_capacity)); }
} guard;
ASSERT_OK(io::SetIOThreadPoolCapacity(1));

auto reader = GetRecordBatchReader(schema({field("utf8", utf8())}));

ASSERT_OK_AND_ASSIGN(auto buffer, ParquetFormatHelper::Write(reader.get()));
auto buffer_reader = std::make_shared<::arrow::io::BufferReader>(buffer);
auto source =
std::make_shared<FileSource>(std::move(buffer_reader), buffer->size());
auto source = std::make_shared<FileSource>(std::move(buffer_reader), buffer->size());
auto options = std::make_shared<ScanOptions>();

{
Expand Down

0 comments on commit 5835df3

Please sign in to comment.