Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

MIN/MAX don't unwrap nested encodings inside Dictionary columns

未关闭 适合新手
#26,290 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@grevend 已经在做这个了。

开始于 2026年10月15日。

  • #26371 来自 @grevend —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust
领域
data

调研方向

从 get_min_max_result_type 函数开始,其中 RunEndEncoded 分支已经会递归进入其值,而 Dictionary 分支只解包一层。查看 MIN/MAX 测试,了解 dictionary 或 run-end 列如何通过 MemTable 构建和查询。完成标准是:对两种嵌套编码的列执行 max 都返回普通的 UInt32 值,且类型为 UInt32,并为每种情况添加测试。

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

描述

bug
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

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/datafusion 的其他 Issue

查看 apache/datafusion 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

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