ParquetCorruptStatisticsException data data_error ai_generated true

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

Parquet corrupted min/max statistics cause predicate pushdown to skip valid rows

ID: data/parquet-corrupted-min-max-statistics

其他格式: JSON · Markdown 中文 · English
85%修复率
85%置信度
1证据数
2023-08-15首次发现

版本兼容性

版本状态引入弃用备注
Parquet 1.12.0+ active
Apache Spark 3.2+ active
Apache Arrow 8.0.0+ active
DuckDB 0.6.0+ active

根因分析

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

English

Parquet file footer stores column chunk min/max statistics that are inconsistent with actual data, causing predicate pushdown filters to incorrectly skip row groups.

generic

官方文档

https://issues.apache.org/jira/browse/PARQUET-2210

解决方案

  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` 并与实际数据范围比较。

无效尝试

常见但无效的做法:

  1. 40% 失败

    Spark uses the same writer logic that may reproduce corrupted statistics if the issue is in the writer library version.

  2. 60% 失败

    Overly broad fix that degrades performance for all queries, not just the affected files.