Skip to content

Conversation

rambleraptor
Copy link
Contributor

@rambleraptor rambleraptor commented Oct 13, 2025

Rationale for this change

Fixes #8614
Part of #7806

We currently panic if the size of an int96 isn't 12. Instead, we should return an error message to avoid a panic.

What changes are included in this PR?

Error message instead of panic.

Are these changes tested?

We typically require tests for all PRs in order to:

  1. Prevent the code from being accidentally broken by subsequent changes
  2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
Test included, existing tests should still pass.

Are there any user-facing changes?

None.

@github-actions github-actions bot added the parquet Changes to the parquet crate label Oct 13, 2025
@etseidl
Copy link
Contributor

etseidl commented Oct 14, 2025

Thanks for the submission @rambleraptor. If it's not too much to ask, could you also open an issue for this?

The test you added actually errors correctly when your change is reverted. I believe the passed-in min/max needs to be > 12 to trigger the panic. Values with a length less than 12 are correctly caught by check_len.

I'm not sure why only INT96 performs a second test and expects an exact length, all other types seem to only require at least enough data is present. Whatever wrote the data causing your issue should also be examined to see why more than 12 bytes are used for what should be a fixed-length array of length 12.

I'd probably opt for simply getting rid of the asserts, but turning the asserts into tests as you have done is probably the safer way to go. I would, however, revert the change to check_len so the behavior for too little data remains the same.

@rambleraptor
Copy link
Contributor Author

@etseidl I reverted the check_len change. Thanks for the suggestion!

I completely agree on checking on our side about how the data is created.

Copy link
Contributor

@etseidl etseidl left a comment

Choose a reason for hiding this comment

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

Thanks @rambleraptor. This looks good to me. I notice that there does not appear to be any testing for not enough data, but that impacts all data types and can be a separate PR.

Copy link
Contributor

@scovich scovich left a comment

Choose a reason for hiding this comment

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

LGTM, pending the recommended test fixes

@rambleraptor
Copy link
Contributor Author

Made the test changes recommended by @etseidl. I'll leave the all data types test changes to a separate PR.

@etseidl
Copy link
Contributor

etseidl commented Oct 14, 2025

Thanks for the improvement @rambleraptor!

@etseidl etseidl merged commit 161adba into apache:main Oct 14, 2025
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.

Error not panic when int96 stastistics aren't size 12

3 participants