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: Improve comments and errors for ArrowPredicate #5230

Merged
merged 2 commits into from
Dec 22, 2023

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Dec 20, 2023

Which issue does this PR close?

N/A

Rationale for this change

While debugging apache/datafusion#8600 it took me a while to figure out what was wrong and I think some better comments and error messages would have helped.

What changes are included in this PR?

Encode some invariants in the comments and error messages.

Are there any user-facing changes?

Better docs and error message

@github-actions github-actions bot added the parquet Changes to the parquet crate label Dec 20, 2023
@alamb alamb force-pushed the alamb/row_selection_error branch from bec60b1 to ec4b04d Compare December 20, 2023 16:06
/// returned [`RowSelection`] will be the conjunction of this and
/// the rows selected by `predicate`
/// If the [`ParquetRecordBatchReader`] also specified an explicit
/// [`RowSelection`] in addition to a predicate, `input_selection` will be
Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC you will also get an input_selection if you have multiple predicates, as it will chain them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I double checked and you are correct. I updated the comments to reflect this detai

@alamb alamb marked this pull request as ready for review December 20, 2023 20:27
let input_rows = maybe_batch.num_rows();
let filter = predicate.evaluate(maybe_batch)?;
// Since user supplied predicate, check error here to catch bugs quickly
if filter.len() != input_rows {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If this doesn't hold true, RowSelection::and_then panics later. Getting a more specific error closer to where the bug happened would have helped me a lot

@tustvold tustvold merged commit 41fda0b into apache:master Dec 22, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parquet Changes to the parquet crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants