-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add page-level I/O and materialization in Hybrid Scan #23375
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
base: main
Are you sure you want to change the base?
Changes from all commits
cf9226a
f356b0d
20508fb
b64685b
382ba5c
af6c466
1cf8e93
d277ca9
7db024f
dbbaee0
d6a6f4c
1dec084
c7c05ae
b563b74
d202c71
06e4085
9c1eeb3
37ee404
411ebd0
acd5be3
d16230d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,10 +38,7 @@ void hybrid_scan_reader_impl::handle_chunking( | |
| // if this is our first time in here, setup the first pass. | ||
| if (!_pass_itm_data) { | ||
| // setup the next pass | ||
| setup_next_pass(column_chunk_data); | ||
|
|
||
| // Must be called as soon as we create the pass | ||
| set_pass_page_mask(data_page_mask); | ||
| setup_next_pass(column_chunk_data, data_page_mask); | ||
| } | ||
|
|
||
| auto& pass = *_pass_itm_data; | ||
|
|
@@ -78,7 +75,8 @@ void hybrid_scan_reader_impl::handle_chunking( | |
| } | ||
|
|
||
| void hybrid_scan_reader_impl::setup_next_pass( | ||
| std::span<cudf::device_span<uint8_t const> const> column_chunk_data) | ||
| std::span<cudf::device_span<uint8_t const> const> column_chunk_data, | ||
| std::span<bool const> data_page_mask) | ||
| { | ||
| auto const num_passes = _file_itm_data.num_passes(); | ||
| CUDF_EXPECTS(num_passes == 1, | ||
|
|
@@ -120,7 +118,16 @@ void hybrid_scan_reader_impl::setup_next_pass( | |
| pass.num_rows = _file_itm_data.global_num_rows; | ||
|
|
||
| // Setup page information for the chunk (which we can access without decompressing) | ||
| setup_compressed_data(column_chunk_data); | ||
| if (_sparse_page_io) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use either the dense or sparse overloads of the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The sparse vs dense functions seem on the edge of similarity where it could make sense to use a template parameter and
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True for |
||
| CUDF_EXPECTS(data_page_mask.empty(), | ||
| "Encountered a non-empty input data page mask in sparse I/O path.", | ||
| std::invalid_argument); | ||
| setup_sparse_compressed_data(column_chunk_data); | ||
| set_sparse_pass_page_mask(column_chunk_data); | ||
| } else { | ||
| setup_compressed_data(column_chunk_data); | ||
| set_pass_page_mask(data_page_mask); | ||
| } | ||
|
|
||
| // detect malformed columns. | ||
| // - we have seen some cases in the wild where we have a row group containing N | ||
|
|
@@ -148,12 +155,20 @@ void hybrid_scan_reader_impl::setup_next_pass( | |
| // store off how much memory we've used so far. This includes the compressed page data and the | ||
| // decompressed dictionary data. we will subtract this from the available total memory for the | ||
| // subpasses | ||
| auto chunk_iter = | ||
| cuda::transform_iterator(pass.chunks.d_begin(), parquet::detail::get_chunk_compressed_size{}); | ||
| pass.base_mem_size = | ||
| decomp_dict_data_size + | ||
| cudf::detail::reduce( | ||
| auto const compressed_data_size = [&] { | ||
| // In Sparse I/O case, compressed chunk size is the sum of its page data span sizes | ||
| if (_sparse_page_io) { | ||
| return std::accumulate(column_chunk_data.begin(), | ||
| column_chunk_data.end(), | ||
| std::size_t{0}, | ||
| [](auto size, auto const& page) { return size + page.size(); }); | ||
| } | ||
| auto chunk_iter = cuda::transform_iterator(pass.chunks.d_begin(), | ||
| parquet::detail::get_chunk_compressed_size{}); | ||
| return cudf::detail::reduce( | ||
| chunk_iter, chunk_iter + pass.chunks.size(), size_t{0}, cuda::std::plus<size_t>{}, _stream); | ||
| }(); | ||
| pass.base_mem_size = decomp_dict_data_size + compressed_data_size; | ||
|
|
||
| // if we are doing subpass reading, generate more accurate num_row estimates for list columns. | ||
| // this helps us to generate more accurate subpass splits. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,19 +47,6 @@ struct metadata : public metadata_base { | |
|
|
||
| class aggregate_reader_metadata : public aggregate_reader_metadata_base { | ||
| private: | ||
| /** | ||
| * @brief Check whether selected columns have column and offset indexes | ||
| * | ||
| * Schema indices are mapped to each source before locating the column chunks. | ||
| * | ||
| * @param row_group_indices Row group indices, one vector per source | ||
| * @param schema_indices Schema indices from the first source | ||
| * @return A pair indicating column-index and offset-index presence, respectively | ||
| */ | ||
| [[nodiscard]] std::pair<bool, bool> page_index_presence( | ||
| std::span<std::vector<size_type> const> row_group_indices, | ||
| std::span<size_type const> schema_indices) const; | ||
|
|
||
| /** | ||
| * @brief Filters the row groups using dictionary pages | ||
| * | ||
|
|
@@ -91,6 +78,19 @@ class aggregate_reader_metadata : public aggregate_reader_metadata_base { | |
| cuda::stream_ref stream) const; | ||
|
|
||
| public: | ||
| /** | ||
| * @brief Check whether selected columns have column and offset indexes | ||
| * | ||
| * Schema indices are mapped to each source before locating the column chunks. | ||
| * | ||
| * @param row_group_indices Row group indices, one vector per source | ||
| * @param schema_indices Schema indices from the first source | ||
| * @return A pair indicating column-index and offset-index presence, respectively | ||
| */ | ||
| [[nodiscard]] std::pair<bool, bool> page_index_presence( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Simply moved from private to public scope |
||
| std::span<std::vector<size_type> const> row_group_indices, | ||
| std::span<size_type const> schema_indices) const; | ||
|
|
||
| /** | ||
| * @brief Constructor for aggregate_reader_metadata | ||
| * | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set_pass_page_maskis now moved inside thesetup_next_pass