#28539·presto

Iceberg: a renamed field inside a struct is read as NULL (ORC always, Parquet with dereference pushdown)

Author: yingsu00Created Sep 23, 2026Updated Sep 23, 2026
Labelsbug

Your Environment

  • Presto version used: master at 9d4e69dce4 ("refactor: Declare a signature when registering a test RPC function (#28496)")
  • Storage (HDFS/S3/GCS..): local file system
  • Data source and connector used: Iceberg connector (Java reader), Hive and Hadoop catalogs
  • Deployment (Cloud or On-prem): local DistributedQueryRunner in tests

Expected Behavior

After a field inside a struct column is renamed, reading that field by its new name returns the values already written, just like a renamed top-level column does.

Current Behavior

The renamed field comes back as NULL for data files written before the rename. The data is still in the files. It is read by the old name and not found.

How bad it is depends on the file format:

Query (after renaming s.a to s.a_renamed) Parquet Parquet, parquet_dereference_pushdown_enabled = false ORC
SELECT s {a_renamed=10, b=20} ✅ {a_renamed=10, b=20} ✅ {a_renamed=NULL, b=20} ❌
SELECT s.a_renamed NULL ❌ 10 ✅ NULL ❌
SELECT count(*) WHERE s.a_renamed = 10 1 ✅ 1 ✅ 0 ❌

The field b, which was not renamed, is always read correctly. The result is the same with pushdown_subfields_enabled on or off.

Possible Solution

Iceberg matches columns by field id, not by name, so that a rename does not need to rewrite any data. The Presto Iceberg reader does this for top-level columns, but not always for fields inside a struct:

  • Parquet: a top-level column is found by field id (IcebergPageSourceProvider.java:466). A dereference pushed down into the Parquet reader, such as s.a_renamed, is found by its name path instead (IcebergPageSourceProvider.java:459). The file only has a field named a, so nothing is found and NULL is returned.
  • ORC: even a full read of the struct loses the renamed field, so fields inside a struct seem to be matched by name in the ORC path as well. I haven't looked into where yet.

Workaround for Parquet: SET SESSION iceberg.parquet_dereference_pushdown_enabled = false. I found no workaround for ORC.

Steps to Reproduce

Presto can't rename a nested field (ALTER TABLE ... RENAME COLUMN only works on top-level columns), so the rename has to be done through the Iceberg API, Spark, or another engine.

  1. In Presto:
    sql
    CREATE TABLE t (id INTEGER, s ROW(a INTEGER, b INTEGER)) WITH (format = 'ORC');  -- or 'PARQUET'
    INSERT INTO t VALUES (1, ROW(10, 20));
  2. Rename the nested field through Iceberg, for example in a Java test:
    java
    table.updateSchema().renameColumn("s.a", "a_renamed").commit();
    or in Spark: ALTER TABLE t RENAME COLUMN s.a TO a_renamed.
  3. In Presto:
    sql
    SELECT s FROM t;                                  -- ORC: a_renamed is NULL
    SELECT s.a_renamed, s.b FROM t;                   -- NULL, 20 (both formats)
    SELECT count(*) FROM t WHERE s.a_renamed = 10;    -- ORC: 0
    Expected: 10 for s.a_renamed everywhere, and a count of 1.

Context

I found this while adding a test for time travel reads over nested schema changes in #28503. That PR doesn't touch this code path, and the results above are from master without it. Tables whose nested fields are renamed by Spark or another engine will return NULLs in Presto for rows written before the rename, with no error.