Reference: parquet-mr/parquet-column/src/main/java/org/apache/parquet/CorruptStatistics.java PARQUET-686 has more discussion on statistics
| 1601 | // parquet-mr/parquet-column/src/main/java/org/apache/parquet/CorruptStatistics.java |
| 1602 | // PARQUET-686 has more discussion on statistics |
| 1603 | bool ApplicationVersion::HasCorrectStatistics(Type::type col_type, |
| 1604 | const EncodedStatistics& statistics, |
| 1605 | SortOrder::type sort_order) const { |
| 1606 | // parquet-cpp version 1.3.0 and parquet-mr 1.10.0 onwards stats are computed |
| 1607 | // correctly for all types |
| 1608 | if ((application_ == "parquet-cpp" && VersionLt(PARQUET_CPP_FIXED_STATS_VERSION())) || |
| 1609 | (application_ == "parquet-mr" && VersionLt(PARQUET_MR_FIXED_STATS_VERSION()))) { |
| 1610 | // Only SIGNED are valid unless max and min are the same |
| 1611 | // (in which case the sort order does not matter) |
| 1612 | bool max_equals_min = statistics.has_min && statistics.has_max |
| 1613 | ? statistics.min() == statistics.max() |
| 1614 | : false; |
| 1615 | if (SortOrder::SIGNED != sort_order && !max_equals_min) { |
| 1616 | return false; |
| 1617 | } |
| 1618 | |
| 1619 | // Statistics of other types are OK |
| 1620 | if (col_type != Type::FIXED_LEN_BYTE_ARRAY && col_type != Type::BYTE_ARRAY) { |
| 1621 | return true; |
| 1622 | } |
| 1623 | } |
| 1624 | // created_by is not populated, which could have been caused by |
| 1625 | // parquet-mr during the same time as PARQUET-251, see PARQUET-297 |
| 1626 | if (application_ == "unknown") { |
| 1627 | return true; |
| 1628 | } |
| 1629 | |
| 1630 | // PARQUET-251 |
| 1631 | if (VersionLt(PARQUET_251_FIXED_VERSION())) { |
| 1632 | return false; |
| 1633 | } |
| 1634 | |
| 1635 | return true; |
| 1636 | } |
| 1637 | |
| 1638 | // MetaData Builders |
| 1639 | // row-group metadata |