Spark: `changes` table returns swapped values when only some changelog columns are selected

未关闭
#19,192 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@adiranjan25 已经在做这个了。

开始于 2026年11月30日。

  • #19207 来自 @adiranjan25 —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
61/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
java, spark
领域
backend, databases

调研方向

Start by tracing how Spark plans projections for the Iceberg changes table, especially when only selected changelog columns or a metadata column are requested. Reproduce the three SQL queries in the issue on Spark 3.5.5 and compare their results with the expected values. Done means partial selections return each value in the correct column and the single-column query no longer throws a ClassCastException.

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

描述

bug
Apache Iceberg version

1.12.0 (latest release)

Query engine

Spark

Please describe the bug 🐞

Selecting only some of _change_type, _change_ordinal and _commit_snapshot_id from a changes table, or one of them together with a metadata column, returns values in the wrong columns or fails with a ClassCastException. Reproduced on main (9d4f6c7, 2026-11-28) and 1.12.0, Spark 3.5.5.

Reproduction
CREATE TABLE local.db.t (id INT, data STRING) USING iceberg;
INSERT INTO local.db.t VALUES (1, 'a');

-- control: all three changelog columns
SELECT 'all', id, _change_type, _change_ordinal, _commit_snapshot_id FROM local.db.t.changes;
SELECT 'with _file', id, _change_type, substring_index(_file, '/', -1) FROM local.db.t.changes;
SELECT 'one column', id, _commit_snapshot_id FROM local.db.t.changes;
Expected
Query Result
all (control) 1 INSERT 0 <snapshot id>
with _file 1 INSERT 00000-0-...parquet
one column 1 <snapshot id>
Actual
Query Result
all (control) same
with _file 1 file:/.../00000-0-...parquet INSERT
one column ClassCastException: UTF8String cannot be cast to Long
Willingness to contribute
  • I can contribute a fix for this bug independently
  • I would be willing to contribute a fix for this bug with guidance from the Iceberg community
  • I cannot contribute a fix for this bug at this time
主要语言
Java
星标
9.5k
派生
3.7k
平均合并
2 天 2 小时
30 天内合并 PR
170

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

apache/iceberg 的其他 Issue

查看 apache/iceberg 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

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