apache / apache/parquet-java

Empty projection returns the wrong number of rows when column index is enabled

未关闭
#2,702 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
Component: Java Component: Parquet Priority: Major Type: bug
主要语言
Java
星标
3.1k
派生
1.6k
平均合并
3 天 12 小时
30 天内合并 PR
33

描述

Discovered in Spark, when returning an empty projection from a Parquet file with filter pushdown enabled (typically when doing filter + count), Parquet-Mr returns a wrong number of rows with column index enabled. When the column index feature is disabled, the result is correct.

 

This happens due to the following:
1. ParquetFileReader::getFilteredRowCount() ( selects row ranges to calculate the row count when column index is enabled.
1. In ColumnIndexFilter ( we filter row ranges and pass the set of paths which in this case is empty.
1. When evaluating the filter, if the column path is not in the set, we would return an empty list of rows ([https://github.com/apache/parquet-mr/blob/0819356a9dafd2ca07c5eab68e2bffeddc3bd3d9/parquet-column/src/main/java/org/apache/parquet/internal/filter2/columnindex/ColumnIndexFilter.java#L178)](https://github.com/apache/parquet-mr/blob/0819356a9dafd2ca07c5eab68e2bffeddc3bd3d9/parquet-column/src/main/java/org/apache/parquet/internal/filter2/columnindex/ColumnIndexFilter.java#L178).) which is always the case for an empty projection.
1. This results in the incorrect number of records reported by the library.

I will provide the full repro later.

 

 

**Reporter**: [Ivan Sadikov](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ivan.sadikov)
#### Related issues:
- [Filtered parquet data frame count() and show() produce inconsistent results when spark.sql.parquet.filterPushdown is true](https://issues.apache.org/jira/browse/SPARK-39833) (is related to)

**Note**: *This issue was originally created as [PARQUET-2170](https://issues.apache.org/jira/browse/PARQUET-2170). Please see the [migration documentation](https://issues.apache.org/jira/browse/PARQUET-2502) for further details.*

贡献指南

这个仓库没有索引到贡献指南

调研方向

从 ParquetFileReader::getFilteredRowCount() 和 ColumnIndexFilter 开始,跟踪空列路径集合在行范围评估中的处理过程。完整复现用例可用后,复现 Spark 的过滤加计数场景,然后验证带有列索引和 filter pushdown 的空投影是否报告正确的行数。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
data-engineering
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。