# Parquet布隆过滤器哈希不匹配：意外的哈希算法ID 0

- **ID:** `data/parquet-bloom-filter-corruption`
- **领域:** data
- **类别:** data_error
- **错误码:** `ParquetBloomFilterHashMismatch`
- **验证级别:** ai_generated
- **修复率:** 78%

## 根因

由旧版本库写入的Parquet文件使用了不支持或未注册的布隆过滤器哈希算法，导致在新版读取器中因严格校验算法ID而读取失败。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Parquet 2.10+ | active | — | — |
| Apache Arrow 12.0+ | active | — | — |
| PyArrow 14.0+ | active | — | — |
| Spark 3.5+ | active | — | — |

## 解决方案

1. ```
   使用更新版本的写入库重写Parquet文件，该库将算法ID 0注册为已知算法。对于PyArrow：`import pyarrow.parquet as pq; table = pq.read_table('file.parquet'); pq.write_table(table, 'file_fixed.parquet')`
   ```
2. ```
   使用不验证布隆过滤器算法ID的旧版读取器。对于Spark：降级到Spark 3.4或更早版本，然后读取并重写文件。
   ```
3. ```
   使用parquet-tools从Parquet文件中剥离布隆过滤器：`java -jar parquet-tools-1.12.3.jar meta file.parquet | grep bloom`，然后使用自定义脚本删除布隆过滤器元数据页面。
   ```

## 无效尝试

- **** — The hash algorithm ID is an on-disk property of the Parquet file; updating the reader library does not change the file's content. (95% 失败率)
- **** — If the original writer is still the old library, the regenerated file will have the same unsupported algorithm ID. (90% 失败率)
- **** — This flag only disables bloom filter creation, not reading. The reader still attempts to parse existing bloom filters. (75% 失败率)
