{"record":{"id":"d32319487cadf131","repo":"prestodb/presto","slug":"table-s-does-not-have-column-s","errorCode":null,"errorMessage":"Table %s does not have column %s","messagePattern":"Table (.+?) does not have column (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-tpcds/src/main/java/com/facebook/presto/tpcds/TpcdsMetadata.java","lineNumber":187,"sourceCode":"        ImmutableMap.Builder<String, ColumnHandle> builder = ImmutableMap.builder();\n        for (ColumnMetadata columnMetadata : getTableMetadata(session, tableHandle).getColumns()) {\n            builder.put(columnMetadata.getName(), new TpcdsColumnHandle(columnMetadata.getName(), columnMetadata.getType()));\n        }\n        return builder.build();\n    }\n\n    @Override\n    public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle columnHandle)\n    {\n        ConnectorTableMetadata tableMetadata = getTableMetadata(session, tableHandle);\n        String columnName = ((TpcdsColumnHandle) columnHandle).getColumnName();\n\n        for (ColumnMetadata column : tableMetadata.getColumns()) {\n            if (column.getName().equals(columnName)) {\n                return column;\n            }\n        }\n        throw new IllegalArgumentException(format(\"Table %s does not have column %s\", tableMetadata.getTable(), columnName));\n    }\n\n    @Override\n    public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)\n    {\n        ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> tableColumns = ImmutableMap.builder();\n        for (String schemaName : getSchemaNames(session, Optional.ofNullable(prefix.getSchemaName()))) {\n            for (Table tpcdsTable : Table.getBaseTables()) {\n                if (prefix.getTableName() == null || tpcdsTable.getName().equals(prefix.getTableName())) {\n                    ConnectorTableMetadata tableMetadata = getTableMetadata(session, schemaName, tpcdsTable, useVarcharType);\n                    tableColumns.put(new SchemaTableName(schemaName, tpcdsTable.getName()), tableMetadata.getColumns());\n                }\n            }\n        }\n        return tableColumns.build();\n    }\n\n    @Override","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-tpcds/src/main/java/com/facebook/presto/tpcds/TpcdsMetadata.java#L169-L205","documentation":"TpcdsMetadata.getColumnMetadata looks up a column by name in a TPC-DS table's metadata and throws IllegalArgumentException when no column matches. It is a safeguard indicating the caller requested metadata for a column that does not exist in the named TPC-DS table.","triggerScenarios":"Calling connector getColumnMetadata (via getColumnMetadata session API) with a columnName that does not exactly match any column of the given table handle, e.g. after a stale or hand-built ColumnHandle.","commonSituations":"Case-sensitive name mismatch ('col' vs 'Col'); using a column name from a different TPC-DS table; stale serialized table/column handles after connector upgrade.","solutions":["Verify the column name spelling and case against the TPC-DS table definition","Re-list columns with listTableColumns/getColumnFields instead of assuming names","Obtain ColumnHandle values from the connector rather than constructing them manually","Restart/rebuild the catalog if handles are stale after a version upgrade"],"exampleFix":"// before\nColumnHandle h = metadata.getColumnMetadata(session, table, \"natin\");\n// after\nColumnHandle h = metadata.getColumnMetadata(session, table, \"nation\");","handlingStrategy":"validation","validationCode":"Set<String> cols = metadata.listTableColumns(session, prefix).get(tableName).stream()\n    .map(ColumnMetadata::getName).collect(Collectors.toSet());\nif (!cols.contains(columnName)) throw new IllegalArgumentException(\"Unknown column \" + columnName + \" in \" + tableName);","typeGuard":null,"tryCatchPattern":"try {\n    ColumnMetadata cm = metadata.getColumnMetadata(session, tableHandle, columnName);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Table \") && e.getMessage().contains(\"does not have column\")) {\n        // re-list columns and retry with corrected name\n    } else { throw e; }\n}","preventionTips":["Always obtain column names from listTableColumns rather than hardcoding","Respect exact case of TPC-DS column names","Re-derive table/column handles after connector upgrades"],"tags":["metadata","tpcds","column-not-found"],"backgroundTag":"column-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"}