MIN/MAX don't unwrap nested encodings inside Dictionary columns
维护者通常 1 天内回复
评估
调研方向
从 get_min_max_result_type 函数开始,其中 RunEndEncoded 分支已经会递归进入其值,而 Dictionary 分支只解包一层。查看 MIN/MAX 测试,了解 dictionary 或 run-end 列如何通过 MemTable 构建和查询。完成标准是:对两种嵌套编码的列执行 max 都返回普通的 UInt32 值,且类型为 UInt32,并为每种情况添加测试。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
get_min_max_result_type recurses into RunEndEncoded values but unwraps Dictionary only one level. When a dictionary's values are themselves encoded, MIN/MAX don't reach the plain value type:
| Column type | max(c) |
|---|---|
Dictionary<Int32, RunEndEncoded<Int32, UInt32>> |
Internal error: Min/Max accumulator not implemented for type RunEndEncoded(...) |
Dictionary<Int32, Dictionary<Int32, UInt32>> |
correct value, typed Dictionary(Int32, UInt32) instead of UInt32 |
To Reproduce
arrow_cast can't build these types, so they only come from a TableProvider, e.g. a MemTable:
let values = RunArray::<Int32Type>::try_new(&Int32Array::from(vec![1, 2]), &UInt32Array::from(vec![1, 3]))?;
let column: ArrayRef = Arc::new(DictionaryArray::<Int32Type>::try_new(Int32Array::from(vec![0, 0, 1]), Arc::new(values))?);
// register `column` as `c` in a MemTable `t`, then:
ctx.sql("SELECT max(c) FROM t").await?.collect().await?; // internal error
Expected behavior
Both columns return max(c) = 3 as UInt32, the same as RunEndEncoded<_, Dictionary<_, UInt32>>.
Additional context
Follow-up to https://github.com/apache/datafusion/pull/26248#discussion_r4267916127. Making the Dictionary arm recurse like the RunEndEncoded arm fixes both cases:
DataType::Dictionary(_, values) => get_min_max_result_type(&[values.deref().clone()]),
Willingness to contribute
I plan to contribute a fix for this bug independently
- 主要语言
- Rust
- 星标
- 9.5k
- 派生
- 2.5k
- 平均合并
- 4 天 19 小时
- 30 天内合并 PR
- 342
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/datafusion 的其他 Issue
-
[Bug] atan2 does not normalize -0.0 the way Spark does可能已有人在做 @spicysharkco 于 1 天前认领。 未关闭bug spark
难度 2/5 1-3 小时 新手友好度 72/100
apache/datafusion#26333 ·
维护者通常 1 天内回复
-
bug help wanted unparser
难度 2/5 1-3 小时 新手友好度 72/100
apache/datafusion#26316 · 1 条评论 ·
维护者通常 1 天内回复
-
Deduplicate bucket computation in width_bucket_interval_mdn_exact可能已有人在做 @nightcityblade 于 2 天前认领。 未关闭enhancement good first issue help wanted spark tech debt
难度 2/5 1-3 小时 新手友好度 85/100
apache/datafusion#26307 · 3 条评论 ·
维护者通常 1 天内回复
-
Use the shared aggr_test_schema in CSV scan tests instead of a local copy可能已有人在做 @med9110 于 2 天前认领。 未关闭core enhancement good first issue help wanted tech debt
难度 2/5 1-3 小时 新手友好度 85/100
apache/datafusion#26306 · 2 条评论 ·
维护者通常 1 天内回复
-
gcd benchmarks pass number_rows: 0 for 100k-row inputs可能已有人在做 @med9110 于 2 天前认领。 未关闭bug functions good first issue help wanted tech debt
难度 1/5 1 小时以内 新手友好度 92/100
apache/datafusion#26297 · 1 条评论 ·
维护者通常 1 天内回复
查看 apache/datafusion 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
EmbarkStudios/cargo-deny#910 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
tursodatabase/turso#10054 ·
维护者通常 1 天内回复
-
build: Update rust version可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭dependencies
难度 2/5 1-3 小时 新手友好度 67/100
ibm-granite-community/granite-cli#229 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
orottier/web-audio-api-rs#658 ·