prestodb/presto · error · PrestoException

ICEBERG_MISSING_COLUMN

ICEBERG_MISSING_COLUMN

Error message

Could not find field  in table schema: 

What it means

Thrown when a column referenced by a column identity (colId) cannot be resolved in the Iceberg table's current schema via tableSchema.findField(id). The reader needs an IcebergColumnHandle for every column it must read from storage, and a missing field means schema and requested columns are inconsistent, so ICEBERG_MISSING_COLUMN is raised.

Source

Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergPageSourceProvider.java:866

                        }
                        else if (colId.getId() == ROW_POSITION.fieldId()) {
                            IcebergColumnHandle handle = IcebergColumnHandle.create(ROW_POSITION, typeManager, REGULAR);
                            columnsToReadFromStorage.add(handle);
                        }
                        else if (colId.getId() == SPEC_ID.fieldId()) {
                            IcebergColumnHandle handle = IcebergColumnHandle.create(SPEC_ID, typeManager, REGULAR);
                            columnsToReadFromStorage.add(handle);
                        }
                        else if (colId.getId() == MERGE_PARTITION_DATA.getId()) {
                            NestedField mergePartitionData = NestedField.required(MERGE_PARTITION_DATA.getId(),
                                    MERGE_PARTITION_DATA.getColumnName(), Types.StringType.get());
                            IcebergColumnHandle handle = IcebergColumnHandle.create(mergePartitionData, typeManager, REGULAR);
                            columnsToReadFromStorage.add(handle);
                        }
                        else {
                            NestedField column = tableSchema.findField(colId.getId());
                            if (column == null) {
                                throw new PrestoException(ICEBERG_MISSING_COLUMN, "Could not find field " + colId + " in table schema: " + tableSchema);
                            }
                            IcebergColumnHandle handle = IcebergColumnHandle.create(column, typeManager, REGULAR);
                            columnsToReadFromStorage.add(handle);
                        }
                    });
        });

        // TODO: pushdownFilter for icebergLayout
        HdfsContext hdfsContext = new HdfsContext(session, table.getSchemaName(), table.getIcebergTableName().getTableName());

        List<IcebergColumnHandle> delegateColumns = columnsToReadFromStorage.stream().collect(toImmutableList());

        ImmutableMap.Builder<Integer, Object> metadataValues = ImmutableMap.builder();
        for (IcebergColumnHandle icebergColumn : icebergColumns) {
            if (icebergColumn.isPathColumn()) {
                metadataValues.put(icebergColumn.getColumnIdentity().getId(), utf8Slice(split.getPath()));
            }
            else if (icebergColumn.isDataSequenceNumberColumn()) {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Refresh table metadata / re-plan the query so the current schema is used
  2. Check the table schema (SHOW COLUMNS / metadata tables) and confirm the field id exists in the snapshot being read
  3. If a column was dropped and recreated, rewrite affected data files or query a snapshot where the id existed
  4. Restore correct metadata (roll back to a snapshot whose schema contains the field)

Example fix

// before: querying stale snapshot referencing dropped field id 12
SELECT * FROM t FOR VERSION AS OF 1111111111;
// after: use current snapshot or rewrite files after schema change
SELECT * FROM t;
Defensive patterns

Strategy: validation

Validate before calling

Schema tableSchema = ...; // current schema
for (ColumnHandle h : desiredColumns) {
    int id = ((IcebergColumnHandle) h).getId();
    if (tableSchema.findField(id) == null) {
        throw new IllegalStateException("Field " + id + " missing from current schema; refresh snapshot");
    }
}

Try / catch

try { source = provider.createPageSource(...); }
catch (PrestoException e) {
  if (ICEBERG_MISSING_COLUMN.toErrorCode().equals(e.getErrorCode())) {
    // reload table metadata / re-plan against current snapshot
  } else throw e;
}

Prevention

When it happens

Trigger: During split/column resolution in createPageSource, a requested column id (from partition data or schema evolution) has no matching NestedField in the current table schema — typically after schema evolution removed or the id was never present.

Common situations: A column was dropped and re-added (new field id) while old snapshots/metadata still reference the old id; reading a stale snapshot whose schema differs from current; metadata file pointing at fields removed by an external rewrite; id confusion after partition evolution.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/50c53b0f6860f327. Report an issue: GitHub.