Time-travel read of a dropped identity-partition source colunm fails

オープン
#19,139 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@adiranjan25 がすでに取り組んでいます。

2026年11月25日 から。

  • #19149 @adiranjan25 による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
18/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
java, sql
領域
data

調査の方向性

The failures come from the Spark read path: ConstantColumnVector.getUTF8String (ConstantColumnVector.java:117) for the ClassCastException, and Spark3Util.SpecTransformToSparkTransform.identity (Spark3Util.java:314) reached through SparkPartitioningAwareScan.outputPartitioning for the NullPointerException. Reproduce with the SQL in the issue, then check how a dropped identity partition field is handled when the tag's schema still contains the column. Done means both VERSION AS OF queries return 1 a 10. Linked PR #19149 is already open against this, so coordinate with it before starting.

索引モデルが issue の本文から書いたものです。

説明

bug
Apache Iceberg version

main (development)

Query engine

Spark

Please describe the bug 🐞

After DROP PARTITION FIELD p and DROP COLUMN p, reading an older tag that still has p fails when p is projected: ClassCastException (String to UTF8String) in the task, or a NullPointerException during planning with preserve-data-grouping=true. The tag is readable before the drop, or when p is not projected. Reproduced on main (2e12b22, 2026-11-25) and 1.12.0, Spark 3.5.5.

Reproduction
CREATE TABLE local.t (id INT, p STRING, v INT) USING iceberg PARTITIONED BY (p);
INSERT INTO local.t VALUES (1, 'a', 10);
ALTER TABLE local.t CREATE TAG hist;
ALTER TABLE local.t DROP PARTITION FIELD p;
SELECT id, p, v FROM local.t VERSION AS OF 'hist';   -- control: 1  a  10
ALTER TABLE local.t DROP COLUMN p;
SELECT id, v FROM local.t VERSION AS OF 'hist';      -- control: 1  10
SELECT id, p, v FROM local.t VERSION AS OF 'hist';   -- (1) ClassCastException

SET `spark.sql.iceberg.planning.preserve-data-grouping`=true;
SELECT id, p, v FROM local.t VERSION AS OF 'hist';   -- (2) NullPointerException

Expected: (1) and (2) return 1 a 10; the tag's schema still contains p.

Actual: both controls return the expected rows. (1) fails in the task:

java.lang.ClassCastException: class java.lang.String cannot be cast to class org.apache.spark.unsafe.types.UTF8String
	at org.apache.iceberg.spark.data.vectorized.ConstantColumnVector.getUTF8String(ConstantColumnVector.java:117)
	at org.apache.spark.sql.catalyst.expressions.GeneratedClass$GeneratedIteratorForCodegenStage1.processNext(Unknown Source)
	...

(2) fails during planning:

org.apache.spark.SparkException: [INTERNAL_ERROR] The Spark SQL phase optimization failed with an internal error. ...
Caused by: java.lang.NullPointerException: Cannot invoke "String.length()" because "s" is null
	at org.apache.spark.sql.connector.expressions.Expressions.identity(Expressions.java:105)
	at org.apache.iceberg.spark.Spark3Util$SpecTransformToSparkTransform.identity(Spark3Util.java:314)
	at org.apache.iceberg.transforms.PartitionSpecVisitor.visit(PartitionSpecVisitor.java:117)
	at org.apache.iceberg.spark.Spark3Util.toTransforms(Spark3Util.java:284)
	at org.apache.iceberg.spark.source.SparkPartitioningAwareScan.groupingKeyTransforms(SparkPartitioningAwareScan.java:151)
	at org.apache.iceberg.spark.source.SparkPartitioningAwareScan.outputPartitioning(SparkPartitioningAwareScan.java:117)
	...
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時間
マージ済み PR(30日)
170

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/iceberg のほかの issue

apache/iceberg の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。