PARQUET-1246: Ignore float/double statistics in case of NaN - #461
Closed
gszadovszky wants to merge 2 commits into
Closed
PARQUET-1246: Ignore float/double statistics in case of NaN#461gszadovszky wants to merge 2 commits into
gszadovszky wants to merge 2 commits into
Conversation
zivanfi
reviewed
Mar 14, 2018
| Float max = stats.genericGetMax(); | ||
| // Drop min/max values in case of NaN as the sorting order of values is undefined for this case | ||
| if (min.isNaN() || max.isNaN()) { | ||
| stats.setMinMax(0.0f, 0.0f); |
Contributor
There was a problem hiding this comment.
This seems unnecessary. On the other hand, this is the default value when it's unset, so I'm fine with leaving this.
| ((Statistics<?>) stats).hasNonNullValue = false; | ||
| } else { | ||
| // Updating min to -0.0 and max to +0.0 to ensure that no 0.0 values would be skipped | ||
| if (min == 0.0f) { |
Contributor
There was a problem hiding this comment.
+0 and -0 are equal according to ==. Please use Float.compareTo() instead.
| // Updating min to -0.0 and max to +0.0 to ensure that no 0.0 values would be skipped | ||
| if (min == 0.0f) { | ||
| stats.setMinMax(-0.0f, max); | ||
| min = -0.0f; |
Contributor
There was a problem hiding this comment.
(nit) In my opinion,
min = -0.0f;
stats.setMinMax(min, max);
would be cleaner. Similar for the max case (although max is not used any more in this function).
| } | ||
|
|
||
| @Override | ||
| public Statistics<?> build() { |
Contributor
There was a problem hiding this comment.
Same comments as for the float case.
| assertEquals(max, stats.genericGetMax()); | ||
| } | ||
|
|
||
| @Test |
Contributor
There was a problem hiding this comment.
Please add test case for -0 and +0.
zivanfi
approved these changes
Mar 14, 2018
zivanfi
left a comment
Contributor
There was a problem hiding this comment.
LGTM, thanks. I'll merge this on Monday if nobody else requests any more changes.
legend-hua
pushed a commit
to legend-hua/parquet-mr
that referenced
this pull request
Mar 23, 2018
Because of the ambigous sorting order of float/double the following changes made at the reading path of the related statistics: - Ignoring statistics in case of it contains a NaN value. - Using -0.0 as min value and +0.0 as max value independently from which 0.0 value was saved in the statistics. Author: Gabor Szadovszky <gabor.szadovszky@cloudera.com> Closes apache#461 from gszadovszky/PARQUET-1246 and squashes the following commits: 20e9332 [Gabor Szadovszky] PARQUET-1246: Changes according to zi's comments 3447938 [Gabor Szadovszky] PARQUET-1246: Ignore float/double statistics in case of NaN
gszadovszky
pushed a commit
to gszadovszky/parquet-mr
that referenced
this pull request
Apr 24, 2018
Because of the ambigous sorting order of float/double the following changes made at the reading path of the related statistics: - Ignoring statistics in case of it contains a NaN value. - Using -0.0 as min value and +0.0 as max value independently from which 0.0 value was saved in the statistics. Author: Gabor Szadovszky <gabor.szadovszky@cloudera.com> Closes apache#461 from gszadovszky/PARQUET-1246 and squashes the following commits: 20e9332 [Gabor Szadovszky] PARQUET-1246: Changes according to zi's comments 3447938 [Gabor Szadovszky] PARQUET-1246: Ignore float/double statistics in case of NaN This change is based on 0a86429 but is not a clean cherry-pick.
zivanfi
pushed a commit
that referenced
this pull request
Apr 25, 2018
Because of the ambigous sorting order of float/double the following changes made at the reading path of the related statistics: - Ignoring statistics in case of it contains a NaN value. - Using -0.0 as min value and +0.0 as max value independently from which 0.0 value was saved in the statistics. Author: Gabor Szadovszky <gabor.szadovszky@cloudera.com> Closes #461 from gszadovszky/PARQUET-1246 and squashes the following commits: 20e9332 [Gabor Szadovszky] PARQUET-1246: Changes according to zi's comments 3447938 [Gabor Szadovszky] PARQUET-1246: Ignore float/double statistics in case of NaN This change is based on 0a86429 but is not a clean cherry-pick.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Because of the ambigous sorting order of float/double the following changes made at the reading path of the related statistics: