{"record":{"id":"fdcce9f9b6c38d86","repo":"apache/seatunnel","slug":"column-fieldname-does-not-exist","errorCode":null,"errorMessage":"column ${fieldName} does not exist.","messagePattern":"column (.+?) does not exist\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/source/converter/SqlToPaimonPredicateConverter.java","lineNumber":132,"sourceCode":"\n        List<String> columnNames = new ArrayList<>();\n        for (SelectItem selectItem : selectItems) {\n            if (selectItem.getExpression() instanceof AllColumns) {\n                return null;\n            } else {\n                String columnName = ((Column) selectItem.getExpression()).getColumnName();\n                columnNames.add(columnName);\n            }\n        }\n\n        projectionIndex =\n                columnNames.stream()\n                        .mapToInt(\n                                columnName -> {\n                                    String fieldName = columnName.replace(\"`\", \"\");\n                                    int index = Arrays.asList(fieldNames).indexOf(fieldName);\n                                    if (index == -1) {\n                                        throw new IllegalArgumentException(\n                                                \"column \" + fieldName + \" does not exist.\");\n                                    }\n                                    return index;\n                                })\n                        .toArray();\n\n        return projectionIndex;\n    }\n\n    public static Predicate convertSqlWhereToPaimonPredicate(\n            RowType rowType, PlainSelect plainSelect) {\n        Expression whereExpression = plainSelect.getWhere();\n        if (Objects.isNull(whereExpression)) {\n            return null;\n        }\n        PredicateBuilder builder = new PredicateBuilder(rowType);\n        return parseExpressionToPredicate(builder, rowType, whereExpression);\n    }","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/source/converter/SqlToPaimonPredicateConverter.java#L114-L150","documentation":"convertSqlSelectToPaimonProjectionIndex maps the SELECT's column list to indices of the Paimon table's field names; when a requested column (after stripping backticks) is not found in fieldNames it throws IllegalArgumentException('column X does not exist.').","triggerScenarios":"A projection SELECT references a column name that does not match any field of the Paimon table schema — wrong name, wrong case, missing quoting, or referencing a column added upstream but not yet synced to Paimon.","commonSituations":"Schema drift between source and Paimon table; typos in projection lists; case-sensitivity differences (CamelCase vs snake_case); backtick handling mismatches; querying a renamed column.","solutions":["Verify the column exists in the Paimon table schema (list fields) and correct the SELECT column list","Match exact case and remove unsupported quoting characters","Sync the Paimon table schema if the column was recently added upstream (schema evolution)","Rebuild the projection list from the actual table fields instead of hardcoding"],"exampleFix":"// before\nString sql = \"SELECT User_Name, age FROM t\"; // table has field userName\n// after\nString sql = \"SELECT userName, age FROM t\";","handlingStrategy":"validation","validationCode":"for (String col : requestedColumns) { String f = col.replace(\"`\", \"\"); if (!Arrays.asList(fieldNames).contains(f)) throw new IllegalArgumentException(\"column \" + f + \" does not exist\"); }","typeGuard":"boolean columnsExist(List<String> cols, String[] fieldNames) { return cols.stream().map(c -> c.replace(\"`\", \"\")).allMatch(c -> Arrays.asList(fieldNames).contains(c)); }","tryCatchPattern":"try { int[] idx = converter.convertSqlSelectToPaimonProjectionIndex(query, fieldNames); } catch (IllegalArgumentException e) { if (e.getMessage().endsWith(\"does not exist.\")) { /* fix projection list */ } throw e; }","preventionTips":["Derive projection lists from the live Paimon table schema","Keep source and sink schemas in sync to avoid drift","Watch for case sensitivity and backtick differences in column names"],"tags":["sql","paimon","projection","column-not-found"],"backgroundTag":"column-not-found","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}