Repository navigation
Expose Parquet column-chunk statistics in pylibcudf #23666
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
Changes from 9 commits
ec40676
6c60795
e71e4df
a039508
9de5438
6ea7be5
8c871cb
25f4e45
996ab71
466cb54
46fcaae
df98442
200792c
c61b4cb
f688c0e
e0b16ab
f920ee1
00bee2d
0d4141f
4adf9d7
6a3b6c6
a936e56
1e62b62
3c8fab7
82c6e71
8c58992
a6d0cdb
418e256
8d48621
baf8c29
8316cdd
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 |
|---|---|---|
|
|
@@ -10,12 +10,18 @@ | |
|
|
||
| #pragma once | ||
|
|
||
| #include <cudf/column/column.hpp> | ||
| #include <cudf/io/datasource.hpp> | ||
| #include <cudf/io/parquet_schema.hpp> | ||
| #include <cudf/io/types.hpp> | ||
| #include <cudf/table/table.hpp> | ||
| #include <cudf/utilities/default_stream.hpp> | ||
| #include <cudf/utilities/export.hpp> | ||
| #include <cudf/utilities/memory_resource.hpp> | ||
|
|
||
| #include <memory> | ||
| #include <span> | ||
| #include <string> | ||
| #include <string_view> | ||
| #include <vector> | ||
|
|
||
|
|
@@ -294,6 +300,49 @@ parquet_metadata read_parquet_metadata(source_info const& src_info); | |
| std::vector<parquet::FileMetaData> read_parquet_footers( | ||
| std::span<std::unique_ptr<cudf::io::datasource> const> sources); | ||
|
|
||
| /** | ||
| * @brief Min/max bounds decoded from parquet column-chunk statistics. | ||
| * | ||
| * ``file_indices`` and ``row_group_indices`` identify the column chunks represented by each row of | ||
| * every table in ``bounds``. Each table in ``bounds`` corresponds positionally to a requested | ||
| * column and contains exactly two columns: decoded minimum values followed by decoded maximum | ||
| * values. | ||
| */ | ||
| struct column_chunk_bounds_result { | ||
| /// File index for each row in every bounds table | ||
| std::unique_ptr<column> file_indices; | ||
| /// File-local row-group index for each row in every bounds table | ||
| std::unique_ptr<column> row_group_indices; | ||
| /// One two-column table per requested column, where column 0 is min and column 1 is max | ||
| std::vector<std::unique_ptr<table>> bounds; | ||
| }; | ||
|
|
||
| /** | ||
| * @brief Decode parquet column-chunk min/max statistics for selected leaf columns. | ||
| * | ||
| * Missing min/max statistics are represented as nulls in the corresponding output column. Parquet | ||
| * min/max exactness flags are not interpreted by this function. The requested column names are | ||
| * resolved against each file's schema. | ||
| * | ||
| * @ingroup io_readers | ||
| * | ||
| * @param parquet_metadatas Parquet file metadata, one per source | ||
| * @param column_names Dotted leaf-column paths to decode statistics for | ||
| * @param stream CUDA stream used for device memory operations | ||
| * @param mr Device memory resource to use for device memory allocation | ||
| * @return Decoded min/max bounds and row-group identifiers | ||
| * | ||
| * @throw std::invalid_argument If a requested leaf-column path is missing or ambiguous. | ||
| * @throw std::invalid_argument If a requested column has unsupported or compound statistics dtype. | ||
| * @throw std::invalid_argument If a requested column has mismatching statistics dtype across | ||
| * sources. | ||
| */ | ||
| column_chunk_bounds_result column_chunk_bounds( | ||
| std::vector<parquet::FileMetaData> parquet_metadatas, | ||
| std::span<std::string const> column_names, | ||
| rmm::cuda_stream_view stream = cudf::get_default_stream(), | ||
| rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); | ||
|
rjzamora marked this conversation as resolved.
Resolved
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. Assuming this is public API, let us avoid introducing a new function with device_async_resource_ref and instead accept a cudf::memory_resources ?
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. Sounds good, done. The public API now takes |
||
|
|
||
| /** @} */ // end of group | ||
| } // namespace io | ||
| } // namespace CUDF_EXPORT cudf | ||
Uh oh!
There was an error while loading. Please reload this page.