# Parquet 损坏的最小/最大统计信息导致谓词下推跳过有效行

- **ID:** `data/parquet-corrupted-min-max-statistics`
- **领域:** data
- **类别:** data_error
- **错误码:** `ParquetCorruptStatisticsException`
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

Parquet 文件页脚存储的列块最小/最大统计信息与实际数据不一致，导致谓词下推过滤器错误地跳过行组。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Parquet 1.12.0+ | active | — | — |
| Apache Spark 3.2+ | active | — | — |
| Apache Arrow 8.0.0+ | active | — | — |
| DuckDB 0.6.0+ | active | — | — |

## 解决方案

1. ```
   禁用统计信息读取 Parquet 文件：`spark.read.option("parquet.filter.statistics.enabled", "false").parquet("path")`
   ```
2. ```
   使用不同库重写 Parquet 文件，如 PyArrow：`import pyarrow.parquet as pq; table = pq.read_table('corrupted.parquet'); pq.write_table(table, 'fixed.parquet')`
   ```
3. ```
   手动验证统计信息：`pq.ParquetFile('file.parquet').metadata.row_group(0).column(0).statistics` 并与实际数据范围比较。
   ```

## 无效尝试

- **** — Spark uses the same writer logic that may reproduce corrupted statistics if the issue is in the writer library version. (40% 失败率)
- **** — Overly broad fix that degrades performance for all queries, not just the affected files. (60% 失败率)
