Repository navigation
Conversation
|
What does parquet-mr do in this situation? |
62b8050 to
83f6a2a
Compare
| metadata.statistics.null_count, metadata.statistics.distinct_count, | ||
| metadata.statistics.__isset.max || metadata.statistics.__isset.min, | ||
| can_use_legacy_min_max && | ||
| (metadata.statistics.__isset.max || metadata.statistics.__isset.min), |
There was a problem hiding this comment.
Note that parquet-mr uses && rather than ||. It probably doesn't make a difference in practice (either min/max are both available, or none is available).
There was a problem hiding this comment.
I tried to change || to && in an old PR and it caused some test failure because filter pushdown of dataset scanner can handle the case when either min or max is missing.
There was a problem hiding this comment.
Ah, funny. Let's keep it like this, then.
|
@mapleFU Would it be easy to add a test here? |
|
I can try to add one in |
|
Oops, I found a // Reference:
// parquet-mr/parquet-column/src/main/java/org/apache/parquet/CorruptStatistics.java
// PARQUET-686 has more discussion on statistics
bool ApplicationVersion::HasCorrectStatistics(Type::type col_type,
EncodedStatistics& statistics,
SortOrder::type sort_order) const {
// parquet-cpp version 1.3.0 and parquet-mr 1.10.0 onwards stats are computed
// correctly for all types
if ((application_ == "parquet-cpp" && VersionLt(PARQUET_CPP_FIXED_STATS_VERSION())) ||
(application_ == "parquet-mr" && VersionLt(PARQUET_MR_FIXED_STATS_VERSION()))) {
// Only SIGNED are valid unless max and min are the same
// (in which case the sort order does not matter)
bool max_equals_min = statistics.has_min && statistics.has_max
? statistics.min() == statistics.max()
: false;
if (SortOrder::SIGNED != sort_order && !max_equals_min) {
return false;
}
// Statistics of other types are OK
if (col_type != Type::FIXED_LEN_BYTE_ARRAY && col_type != Type::BYTE_ARRAY) {
return true;
}
}
// created_by is not populated, which could have been caused by
// parquet-mr during the same time as PARQUET-251, see PARQUET-297
if (application_ == "unknown") {
return true;
}
// Unknown sort order has incorrect stats
if (SortOrder::UNKNOWN == sort_order) {
return false;
}
// PARQUET-251
if (VersionLt(PARQUET_251_FIXED_VERSION())) {
return false;
}
return true;
}Though Should I keep this code to avoid generate |
|
In this case, I would prefer the current behavior and close this PR. |
|
|
|
Ah, I see, it's the other way round: |
|
Close as already fixed |
Rationale for this change
As mentioned:
disable
minmaxwhenmin_valuemax_valueis not reachable. And sort-order is notSIGNEDWhat changes are included in this PR?
add a
can_has_legacy_min_maxcheck here.Are these changes tested?
no
Are there any user-facing changes?
Yes, some user may cannot get the statistics here.