JVM columnar shuffle panics on a struct column with a NullType field
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
调研方向
从 native/shuffle/src/spark_unsafe/row.rs 开始,查看两个按字段组织的函数 append_struct_fields_field_major 和 append_nested_struct_fields_field_major,它们在 DataType::Null 上会触发 unreachable!。对比同一文件中 append_field 已有的 Null 分支,了解每行的 null 是如何追加的。当 issue 中的三个 SQL 复现返回与 Spark 相同的行,并且有一个回归测试覆盖顶层 struct 和含 null 字段的嵌套 struct 时,即完成。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
A shuffle that runs on Comet's JVM columnar shuffle fails the query when one of its columns is a struct with a NullType field, such as named_struct('x', a, 'n', null). The row-to-Arrow conversion panics:
org.apache.comet.CometNativeException: internal error: entered unreachable code: Unsupported data type of struct field: Null
at datafusion_comet_shuffle::spark_unsafe::row::append_struct_fields_field_major
at datafusion_comet_shuffle::spark_unsafe::row::append_columns
at datafusion_comet_shuffle::spark_unsafe::row::process_sorted_row_partition
at comet::execution::jni_api::write_sorted_file
at comet::execution::jni_api::Java_org_apache_comet_Native_writeSortedFileNative
Spark returns the rows. Both field-major struct paths in native/shuffle/src/spark_unsafe/row.rs lack a DataType::Null arm and fall through to unreachable!. append_struct_fields_field_major handles a top-level struct column, and append_nested_struct_fields_field_major handles a struct inside a struct:
append_field in the same file already has the arm. The JVM columnar shuffle's type check accepts NullType at any depth, so nothing keeps these schemas away from the converter, and Null is the only type that check accepts that the two functions are missing.
With the default configuration this hits every round-robin repartition of such a column, because native round robin is off by default and those shuffles run on JVM columnar shuffle. It also hits a hash shuffle that runs on JVM columnar shuffle, for example under spark.comet.shuffle.mode=jvm. A hash shuffle over a native child runs on native shuffle and works. Arrays and maps that hold nulls (array(null), map(k, null), array(named_struct('x', a, 'n', null))) also work.
Steps to reproduce
CREATE TABLE t (a INT) USING parquet;
INSERT INTO t SELECT CAST(id AS INT) FROM range(1000);
-- top-level struct column
SELECT /*+ REPARTITION(4) */ a, named_struct('x', a, 'n', null) AS st FROM t;
-- struct inside a struct
SELECT /*+ REPARTITION(4) */ a, named_struct('s', named_struct('x', a, 'n', null)) AS st FROM t;
-- hash partitioning on JVM columnar shuffle
SET spark.comet.shuffle.mode=jvm;
SELECT a, named_struct('x', a, 'n', null) AS st FROM t DISTRIBUTE BY a;
All three fail with the panic above. I reproduced them on c3316fbe39 with the Spark 4.1 profile, and the code involved is unchanged on main at 3a4a159409.
Expected behavior
The queries should return the same rows as Spark. Every value of a NullType field is null, so a DataType::Null arm in both functions that appends one null per row, as append_field does, should be enough. A regression test with a top-level and a nested struct would cover both paths.
Additional context
#6977 proposes merging the two field-major functions, which would make an arm like this one change instead of two.
- 主要语言
- Scala
- 星标
- 1.3k
- 派生
- 391
- 平均合并
- 2 天 10 小时
- 30 天内合并 PR
- 421
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/datafusion-comet 的其他 Issue
-
area:shuffle enhancement good first issue performance requires-triage
难度 2/5 1-3 小时 新手友好度 78/100
apache/datafusion-comet#7072 ·
维护者通常 1 天内回复
-
Native hashing of NullType and ANSI interval values fails with "Unsupported data type in hasher"可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭area:expressions area:shuffle bug priority:high requires-triage
难度 2/5 1-3 小时 新手友好度 62/100
apache/datafusion-comet#7063 ·
维护者通常 1 天内回复
-
requires-triage
难度 2/5 1-3 小时 新手友好度 68/100
apache/datafusion-comet#7001 ·
维护者通常 1 天内回复
-
Extract shared list-array construction from the split_* functions in split.rs可能已有人在做 @arminazimi 于 2 天前认领。 未关闭area:expressions enhancement good first issue help wanted requires-triage rust tech debt
难度 2/5 1-3 小时 新手友好度 82/100
apache/datafusion-comet#6983 ·
维护者通常 1 天内回复
-
Deduplicate spark_ceil and spark_floor and port floor's decimal boundary tests to ceil可能已有人在做 @med9110 于 2 天前认领。 未关闭area:expressions enhancement help wanted requires-triage rust tech debt
难度 2/5 半天 新手友好度 68/100
apache/datafusion-comet#6974 · 1 条评论 ·
维护者通常 1 天内回复
查看 apache/datafusion-comet 的全部 Issue
相似的 Issue
-
Bound wrong-magic P2P diagnostics to parsed header bytes可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
ergoplatform/ergo#2736 ·
维护者通常 1 天内回复
-
bug 🐞 CI/CD ⚒️
难度 2/5 1-3 小时 新手友好度 78/100
valkey-io/valkey-glide#7370 ·
维护者通常 1 天内回复
-
Improve UI text on confirmation page (at registration)可能已有人在做 @Arghyann 今天认领。 未关闭good first issue improvement
难度 1/5 1 小时以内 新手友好度 72/100
lichess-org/lila#22126 · 2 条评论 ·
维护者通常 1 天内回复
-
[VL] Remove the unused ShuffleSchema.h可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 1/5 1 小时以内 新手友好度 82/100
维护者通常 2 天内回复
-
agent-ready area/dev-tooling kind/docs-only layer/docs size/XS
难度 2/5 1-3 小时 新手友好度 70/100
marola-dev/marola#855 ·
维护者通常 1 天内回复