fix: ParquetError when reading corrupt parquet file with truncated data instead of Panic#9725
Conversation
…ta instead of Panic
alamb
left a comment
There was a problem hiding this comment.
Makes sense to me -- thank you @xuzifu666
etseidl
left a comment
There was a problem hiding this comment.
Thanks for the quick fix @xuzifu666
|
I would feel more comfortable if there were a test for this, but I'm having a hard time reproducing. Probably not worth holding this up for since it's simply replacing asserts with errors. What do you think @alamb? |
Yes, this test is indeed difficult to build. I simulated a scenario with an error file as much as possible to verify that a ParquetError is returned when reading the file. |
| read_and_check(f.as_file(), PageIndexPolicy::Skip).unwrap(); | ||
| } | ||
|
|
||
| /// Test that corrupted parquet files return ParquetError instead of panicking |
There was a problem hiding this comment.
I think this test is too specific and will be hard to maintain over the long run as the programatic generation of bad data will be brittle (if we change how the thrift is written, for example, the truncation may go down a different path).
If we want to test this type of error condition I think we should either:
- Check in a broken parquet file
- (better) implement a fuzzer that breaks the parquet file in random ways (maybe truncates it arbitrarily, etc) and ensures there are no panics
But for this PR if we want coverage I recommend we check in the bad file rather than trying to generate it programatically. We can consider parquet fuzz tsting as a follow on
There was a problem hiding this comment.
Thanks for your suggestion! Previous test way is not suitable, I had deleted it. Can we resolve this issue in this way for now? Parquet fuzz tsting could be a follow-up task~ @alamb
There was a problem hiding this comment.
Filed a ticket to track fuzz:
| read_and_check(f.as_file(), PageIndexPolicy::Skip).unwrap(); | ||
| } | ||
|
|
||
| /// Test that corrupted parquet files return ParquetError instead of panicking |
There was a problem hiding this comment.
Filed a ticket to track fuzz:
|
Thanks @xuzifu666 and @etseidl |
…ta instead of Panic (apache#9725) # Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. --> - Closes apache#9705 # Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> # What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> # 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)? --> # Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. If there are any breaking changes to public APIs, please call them out. -->
Which issue does this PR close?
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?