-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Extend Parquet reader output_dict_columns to fixed-width columns and sized indices #23890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
a-hirota
wants to merge
4
commits into
NVIDIA:main
Choose a base branch
from
a-hirota:feature/parquet-dictionary-passthrough
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8d03fad
Extend Parquet reader output_dict_columns to flat fixed-width columns…
a-hirota 0db2f6c
Fix dictionary concatenate for INT8/INT16 indices
a-hirota f3083bf
Address review: docs, index-width and fallback tests, transcode bench…
a-hirota 90107c5
Include empty dictionary views in the output indices type selection
a-hirota File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
cpp/benchmarks/io/parquet/parquet_reader_dict_transcode.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| #include <benchmarks/common/generate_input.hpp> | ||
| #include <benchmarks/common/memory_stats.hpp> | ||
| #include <benchmarks/io/cuio_common.hpp> | ||
| #include <benchmarks/io/nvbench_helpers.hpp> | ||
|
|
||
| #include <cudf/io/parquet.hpp> | ||
| #include <cudf/utilities/default_stream.hpp> | ||
|
|
||
| #include <nvbench/nvbench.cuh> | ||
|
|
||
| // Size of the data in the benchmark dataframe; chosen to be low enough to allow benchmarks to | ||
| // run on most GPUs, but large enough to allow highest throughput | ||
| constexpr std::size_t data_size = 512 << 20; | ||
|
|
||
| // Measures reads of dictionary-encoded low-cardinality columns with and without the direct | ||
| // Parquet-dictionary -> DICTIONARY32 transcode (`output_dict_columns`), over the column types the | ||
| // fast path accepts: flat strings and flat fixed-width INT32/INT64/TIMESTAMP_DAYS columns. | ||
| template <output_dict OutputDict> | ||
| void BM_parquet_read_dict_transcode(nvbench::state& state, | ||
| nvbench::type_list<nvbench::enum_type<OutputDict>>) | ||
| { | ||
| auto constexpr output_dict_columns = OutputDict == output_dict::YES; | ||
|
|
||
| auto const cardinality = static_cast<cudf::size_type>(state.get_int64("cardinality")); | ||
| auto const run_length = static_cast<cudf::size_type>(state.get_int64("run_length")); | ||
|
|
||
| auto const data_types = std::vector<cudf::type_id>{cudf::type_id::INT32, | ||
| cudf::type_id::INT64, | ||
| cudf::type_id::TIMESTAMP_DAYS, | ||
| cudf::type_id::STRING}; | ||
| data_profile const profile = | ||
| data_profile_builder().cardinality(cardinality).avg_run_length(run_length); | ||
| auto const tbl = create_random_table(data_types, table_size_bytes{data_size}, profile); | ||
| auto const view = tbl->view(); | ||
|
|
||
| cuio_source_sink_pair source_sink(io_type::HOST_BUFFER); | ||
| auto const write_options = | ||
| cudf::io::parquet_writer_options::builder(source_sink.make_sink_info(), view) | ||
| .dictionary_policy(cudf::io::dictionary_policy::ALWAYS) | ||
| .build(); | ||
| cudf::io::write_parquet(write_options); | ||
|
|
||
| cudf::io::parquet_reader_options read_options = | ||
| cudf::io::parquet_reader_options::builder(source_sink.make_source_info()) | ||
| .output_dict_columns(output_dict_columns) | ||
| .build(); | ||
|
|
||
| auto mem_stats_logger = cudf::memory_stats_logger(); | ||
| state.set_cuda_stream(nvbench::make_cuda_stream_view(cudf::get_default_stream().value())); | ||
| state.exec( | ||
| nvbench::exec_tag::sync | nvbench::exec_tag::timer, [&](nvbench::launch& launch, auto& timer) { | ||
| drop_page_cache_if_enabled(read_options.get_source().filepaths()); | ||
| timer.start(); | ||
| auto const result = cudf::io::read_parquet(read_options); | ||
| timer.stop(); | ||
| CUDF_EXPECTS(result.tbl->num_rows() == view.num_rows(), | ||
| "Benchmark did not read the entire table"); | ||
| CUDF_EXPECTS(result.tbl->num_columns() == view.num_columns(), "Unexpected number of columns"); | ||
| }); | ||
|
|
||
| auto const elapsed_time = state.get_summary("nv/cold/time/gpu/mean").get_float64("value"); | ||
| state.add_element_count(static_cast<double>(data_size) / elapsed_time, "bytes_per_second"); | ||
| state.add_buffer_size( | ||
| mem_stats_logger.peak_memory_usage(), "peak_memory_usage", "peak_memory_usage"); | ||
| state.add_buffer_size(source_sink.size(), "encoded_file_size", "encoded_file_size"); | ||
| } | ||
|
|
||
| NVBENCH_BENCH_TYPES(BM_parquet_read_dict_transcode, | ||
| NVBENCH_TYPE_AXES(nvbench::enum_type_list<output_dict::NO, output_dict::YES>)) | ||
| .set_name("parquet_read_dict_transcode") | ||
| .set_type_axes_names({"output_dict_columns"}) | ||
| .set_min_samples(4) | ||
| .add_int64_axis("cardinality", {1000}) | ||
| .add_int64_axis("run_length", {4}); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.