`CoalescePartitionsExec::cardinality_effect` returns `Equal` when `fetch` is set
维护者通常 1 天内回复
评估
调研方向
首先找到 CoalescePartitionsExec::cardinality_effect 以及该运算符现有的测试;比较设置 fetch 时它与 SortExec 和 SortPreservingMergeExec 的行为。为有 fetch 和无 fetch 的情况添加或更新测试,并确认报告的效果分别为 LowerEqual 和 Equal。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
CoalescePartitionsExec::cardinality_effect always returns CardinalityEffect::Equal, which is documented as "the operator is guaranteed to produce exactly one row for each input row". When fetch is set, the operator can produce fewer rows than its input, so it should return CardinalityEffect::LowerEqual, as SortExec and SortPreservingMergeExec already do when they have a fetch.
Any code that relies on cardinality_effect gets the wrong answer for this operator. For example, PassthroughStatisticsProvider returns the input statistics unchanged for operators with CardinalityEffect::Equal, so a CoalescePartitionsExec with fetch = 10 over 1000 rows reports Exact(1000) instead of Exact(10).
To Reproduce
let plan = CoalescePartitionsExec::new(input).with_fetch(Some(10));
assert!(matches!(plan.cardinality_effect(), CardinalityEffect::LowerEqual)); // fails: Equal
Expected behavior
cardinality_effect returns CardinalityEffect::LowerEqual when fetch is set, and CardinalityEffect::Equal otherwise.
Additional context
Other readers of cardinality_effect are the physical optimizer rules sort_pushdown, topk_aggregation and limit_pushdown_past_window. I did not find a query that returns wrong results because of this, and no sqllogictest plan changes with the fix.
- 主要语言
- Rust
- 星标
- 9.4k
- 派生
- 2.5k
- 平均合并
- 4 天 1 小时
- 30 天内合并 PR
- 376
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/datafusion 的其他 Issue
-
array_min / array_max fail on a zero-row batch for non-primitive element types可能已有人在做 @linuxpi 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
apache/datafusion#26072 ·
维护者通常 1 天内回复
-
BaselineMetrics output_bytes converts every column to ArrayData for every batch可能已有人在做 @minhh-nguyen 于 2 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
apache/datafusion#26071 · 1 条评论 ·
维护者通常 1 天内回复
-
Replace manual `RowSelection` bitmap conversion with `force_mask()` after arrow-rs release可能已有人在做 @isabellehuangg 于 4 天前认领。 未关闭enhancement
难度 2/5 1-3 小时 新手友好度 76/100
apache/datafusion#26030 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Lambda examples in the SQL function docs fail with the default dialect可能已有人在做 @Prajwal-k-tech 于 4 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
apache/datafusion#25960 ·
维护者通常 1 天内回复
-
Spark `xxhash64` hashes the raw bits of a NaN instead of the canonical NaN可能已有人在做 @mrhard9090 于 6 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 84/100
apache/datafusion#25913 ·
维护者通常 1 天内回复
查看 apache/datafusion 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 75/100
element-hq/lk-jwt-service#248 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
pact-foundation/pact-cli#154 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
antithesishq/bombadil#361 ·
维护者通常 1 天内回复
-
test(executor_l0): assert execute() TaskOutcome, not only bus events / 断言 execute() 返回的 TaskOutcome未关闭type:debt
难度 2/5 1-3 小时 新手友好度 62/100
skaiy/wild_agentos#425 ·
维护者通常 1 天内回复