Skip to content
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

Minor: refine row selection example more #5850

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions parquet/src/arrow/arrow_reader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,24 +155,43 @@ impl<T> ArrowReaderBuilder<T> {
///
/// # Example
///
/// Given a parquet file with 3 row groups, and a row group filter of
/// `[0, 2]`, in order to only scan rows 50-100 in row group 2:
/// Given a parquet file with 4 row groups, and a row group filter of `[0,
/// 2, 3]`, in order to scan rows 50-100 in row group 2 and rows 200-300 in
/// row group 3:
///
/// ```text
/// Row Group 0, 1000 rows (selected)
/// Row Group 1, 1000 rows (skipped)
/// Row Group 2, 1000 rows (selected, but want to only scan rows 50-100)
/// Row Group 3, 1000 rows (selected, but want to only scan rows 200-300)
/// ```
///
/// You would pass the following [`RowSelection`]:
/// You could pass the following [`RowSelection`]:
///
/// ```text
/// Select 1000 (scan all rows in row group 0)
/// Select 50-100 (scan rows 50-100 in row group 2)
/// Skip 50 (skip the first 50 rows in row group 2)
/// Select 50 (scan rows 50-100 in row group 2)
/// Skip 900 (skip the remaining rows in row group 2)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not showing this "skip remaining rows in row group" I think was part of what was confusing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember if this is actually required, the readers actually trim trailing skips, but good to document regardless

/// Skip 200 (skip the first 200 rows in row group 3)
/// Select 100 (scan rows 200-300 in row group 3)
/// Skip 700 (skip the remaining rows in row group 3)
/// ```
///
/// Note there is no entry for the (entirely) skipped row group 1.
///
/// Note you can represent the same selection with fewer entries. Instead of
///
/// ```text
/// Skip 900 (skip the remaining rows in row group 2)
/// Skip 200 (skip the first 200 rows in row group 3)
/// ```
///
/// you could use
///
/// ```text
/// Skip 1100 (skip the remaining 900 rows in row group 2 and the first 200 rows in row group 3)
/// ```
///
/// [`Index`]: crate::file::page_index::index::Index
pub fn with_row_selection(self, selection: RowSelection) -> Self {
Self {
Expand Down
Loading