You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "jackwener (via GitHub)" <gi...@apache.org> on 2023/08/04 07:08:15 UTC
[GitHub] [arrow-rs] jackwener opened a new pull request, #4642: refactor: from_thrift avoid panic
jackwener opened a new pull request, #4642:
URL: https://github.com/apache/arrow-rs/pull/4642
# Which issue does this PR close?
Closes #3577.
# 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 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 add the `breaking change` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] tustvold merged pull request #4642: fix: from_thrift avoid panic when stats in invalid.
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold merged PR #4642:
URL: https://github.com/apache/arrow-rs/pull/4642
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] tustvold commented on a diff in pull request #4642: fix: from_thrift avoid panic when stats in invalid.
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4642:
URL: https://github.com/apache/arrow-rs/pull/4642#discussion_r1284478543
##########
parquet/src/file/statistics.rs:
##########
@@ -119,15 +120,18 @@ macro_rules! statistics_enum_func {
pub fn from_thrift(
physical_type: Type,
thrift_stats: Option<TStatistics>,
-) -> Option<Statistics> {
- match thrift_stats {
+) -> Result<Option<Statistics>> {
+ Ok(match thrift_stats {
Some(stats) => {
// Number of nulls recorded, when it is not available, we just mark it as 0.
let null_count = stats.null_count.unwrap_or(0);
- assert!(
- null_count >= 0,
- "Statistics null count is negative ({null_count})"
- );
+
+ if null_count < 0 {
Review Comment:
Another option would be to use try_into()
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org