read_side_padding ignores the pad string for dictionary inputs in lpad and rpad
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
问题位于 native/spark-expr/src/static_invoke/char_varchar_utils/read_side_padding.rs 中处理 Dictionary 输入的三参数分支:两个 Dictionary 分支都传入了 SPACE,而 Utf8 和 LargeUtf8 分支传入的是填充字符串。请先阅读该分支,然后添加一个单元测试,使用 Dictionary 输入和非空格的填充字符串(例如 "x"),期望结果为 ["abxxx", "abxxx"]。当同一输入下 Dictionary 的结果与 Utf8 的结果一致时,即完成。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
In read_side_padding.rs, the three-argument arm ([Array, Scalar(Int32), Scalar(Utf8)]) ignores the pad string when the input is a dictionary array. The Utf8 and LargeUtf8 branches pass string to spark_read_side_padding_internal, but both Dictionary branches pass SPACE. So rpad/lpad with a custom pad pads with spaces instead.
Steps to reproduce
Kernel-level, on main at 644a87088:
let dict: DictionaryArray<Int32Type> = vec!["ab", "ab"].into_iter().collect();
let args = vec![
ColumnarValue::Array(Arc::new(dict)),
ColumnarValue::Scalar(ScalarValue::Int32(Some(5))),
ColumnarValue::Scalar(ScalarValue::Utf8(Some("x".to_string()))),
];
spark_rpad(&args) // ["ab ", "ab "]
I couldn't find a SQL query that reaches this today. The native scan input unpacks dictionary-encoded strings (see test_unpack_dictionary_string in planner.rs), and the existing string_rpad.sql tests with a custom pad pass. So this looks latent, but it would give silent wrong results if a dictionary array ever reaches the kernel, which is what the Dictionary arm (added for SPARK-48498) is there for.
Expected behavior
["abxxx", "abxxx"], the same as for a Utf8 input.
Additional context
Found while reviewing my change for #7245 (PR #7450). The fix is to pass string instead of SPACE in the two Dictionary branches and add a unit test with a dictionary input and a non-space pad.
Willingness to contribute
I can contribute a fix for this bug independently
AI disclosure: this issue was investigated and written with an AI coding assistant, and reviewed by me.
- 主要语言
- Scala
- 星标
- 1.3k
- 派生
- 405
- 平均合并
- 3 天 3 小时
- 30 天内合并 PR
- 269
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/datafusion-comet 的其他 Issue
-
requires-triage
难度 2/5 1-3 小时 新手友好度 78/100
apache/datafusion-comet#7479 ·
维护者通常 2 天内回复
-
area:writer enhancement requires-triage
难度 2/5 1-3 小时 新手友好度 62/100
apache/datafusion-comet#7463 ·
维护者通常 2 天内回复
-
requires-triage
难度 2/5 1-3 小时 新手友好度 78/100
apache/datafusion-comet#7458 ·
维护者通常 2 天内回复
-
area:ci enhancement priority:low requires-triage
难度 2/5 1-3 小时 新手友好度 74/100
apache/datafusion-comet#7319 · 1 条评论 ·
维护者通常 2 天内回复
-
area:ci bug priority:low requires-triage
难度 2/5 1-3 小时 新手友好度 78/100
apache/datafusion-comet#7315 ·
维护者通常 2 天内回复
查看 apache/datafusion-comet 的全部 Issue
相似的 Issue
-
bug 🐞 python 🐍
难度 2/5 1-3 小时 新手友好度 83/100
valkey-io/valkey-glide#7560 ·
维护者通常 1 天内回复
-
enhancement good first issue help wanted
难度 2/5 1-3 小时 新手友好度 90/100
维护者通常 1 天内回复
-
bug minor
难度 1/5 1 小时以内 新手友好度 82/100
propensive/soundness#2418 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 78/100
digital-asset/canton#710 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 70/100
scylladb/scylla-migrator#432 ·
维护者通常 1 天内回复