{"record":{"id":"50c53b0f6860f327","repo":"prestodb/presto","slug":"iceberg-missing-column","errorCode":"ICEBERG_MISSING_COLUMN","errorMessage":"Could not find field  in table schema: ","messagePattern":"Could not find field  in table schema: ","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergPageSourceProvider.java","lineNumber":866,"sourceCode":"                        }\n                        else if (colId.getId() == ROW_POSITION.fieldId()) {\n                            IcebergColumnHandle handle = IcebergColumnHandle.create(ROW_POSITION, typeManager, REGULAR);\n                            columnsToReadFromStorage.add(handle);\n                        }\n                        else if (colId.getId() == SPEC_ID.fieldId()) {\n                            IcebergColumnHandle handle = IcebergColumnHandle.create(SPEC_ID, typeManager, REGULAR);\n                            columnsToReadFromStorage.add(handle);\n                        }\n                        else if (colId.getId() == MERGE_PARTITION_DATA.getId()) {\n                            NestedField mergePartitionData = NestedField.required(MERGE_PARTITION_DATA.getId(),\n                                    MERGE_PARTITION_DATA.getColumnName(), Types.StringType.get());\n                            IcebergColumnHandle handle = IcebergColumnHandle.create(mergePartitionData, typeManager, REGULAR);\n                            columnsToReadFromStorage.add(handle);\n                        }\n                        else {\n                            NestedField column = tableSchema.findField(colId.getId());\n                            if (column == null) {\n                                throw new PrestoException(ICEBERG_MISSING_COLUMN, \"Could not find field \" + colId + \" in table schema: \" + tableSchema);\n                            }\n                            IcebergColumnHandle handle = IcebergColumnHandle.create(column, typeManager, REGULAR);\n                            columnsToReadFromStorage.add(handle);\n                        }\n                    });\n        });\n\n        // TODO: pushdownFilter for icebergLayout\n        HdfsContext hdfsContext = new HdfsContext(session, table.getSchemaName(), table.getIcebergTableName().getTableName());\n\n        List<IcebergColumnHandle> delegateColumns = columnsToReadFromStorage.stream().collect(toImmutableList());\n\n        ImmutableMap.Builder<Integer, Object> metadataValues = ImmutableMap.builder();\n        for (IcebergColumnHandle icebergColumn : icebergColumns) {\n            if (icebergColumn.isPathColumn()) {\n                metadataValues.put(icebergColumn.getColumnIdentity().getId(), utf8Slice(split.getPath()));\n            }\n            else if (icebergColumn.isDataSequenceNumberColumn()) {","sourceCodeStart":848,"sourceCodeEnd":884,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergPageSourceProvider.java#L848-L884","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Refresh table metadata / re-plan the query so the current schema is used","Check the table schema (SHOW COLUMNS / metadata tables) and confirm the field id exists in the snapshot being read","If a column was dropped and recreated, rewrite affected data files or query a snapshot where the id existed","Restore correct metadata (roll back to a snapshot whose schema contains the field)"],"exampleFix":"// before: querying stale snapshot referencing dropped field id 12\nSELECT * FROM t FOR VERSION AS OF 1111111111;\n// after: use current snapshot or rewrite files after schema change\nSELECT * FROM t;","handlingStrategy":"validation","validationCode":"Schema tableSchema = ...; // current schema\nfor (ColumnHandle h : desiredColumns) {\n    int id = ((IcebergColumnHandle) h).getId();\n    if (tableSchema.findField(id) == null) {\n        throw new IllegalStateException(\"Field \" + id + \" missing from current schema; refresh snapshot\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try { source = provider.createPageSource(...); }\ncatch (PrestoException e) {\n  if (ICEBERG_MISSING_COLUMN.toErrorCode().equals(e.getErrorCode())) {\n    // reload table metadata / re-plan against current snapshot\n  } else throw e;\n}","preventionTips":["Avoid drop-and-recreate of columns in the same names during active queries","Refresh metadata clients before long-running multi-statement jobs","Check snapshot schemas before querying historical versions","Run maintenance (rewrite) after schema evolution so old files align with new ids"],"tags":["iceberg","schema-mismatch","missing-column","schema-evolution"],"backgroundTag":"schema-field-not-found","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}