{"record":{"id":"eccc632dc33499f1","repo":"apache/seatunnel","slug":"the-read-columns-configuration-will-be-filtered-by","errorCode":null,"errorMessage":"The read columns configuration will be filtered by the schema configuration, this may cause the actual results to be inconsistent with expectations. This is due to read columns not being a subset of the schema, maybe you should check the schema and read_columns!","messagePattern":"The read columns configuration will be filtered by the schema configuration, this may cause the actual results to be inconsistent with expectations\\. This is due to read columns not being a subset of the schema, maybe you should check the schema and read_columns!","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/XmlReadStrategy.java","lineNumber":242,"sourceCode":"    }\n\n    @Override\n    public void setCatalogTable(CatalogTable catalogTable) {\n        SeaTunnelRowType rowType = catalogTable.getSeaTunnelRowType();\n        if (ArrayUtils.isEmpty(rowType.getFieldNames())\n                || ArrayUtils.isEmpty(rowType.getFieldTypes())) {\n            throw new FileConnectorException(\n                    CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT,\n                    \"Schema information is undefined or misconfigured, please check your configuration file.\");\n        }\n\n        String partitionPath = getPathForPartitionInference(null);\n        if (readColumns.isEmpty()) {\n            this.seaTunnelRowType = rowType;\n            this.seaTunnelRowTypeWithPartition = mergePartitionTypes(partitionPath, rowType);\n        } else {\n            if (readColumns.retainAll(Arrays.asList(rowType.getFieldNames()))) {\n                log.warn(\n                        \"The read columns configuration will be filtered by the schema configuration, this may cause the actual results to be inconsistent with expectations. This is due to read columns not being a subset of the schema, \"\n                                + \"maybe you should check the schema and read_columns!\");\n            }\n            int[] indexes = new int[readColumns.size()];\n            String[] fields = new String[readColumns.size()];\n            SeaTunnelDataType<?>[] types = new SeaTunnelDataType[readColumns.size()];\n            for (int i = 0; i < readColumns.size(); i++) {\n                indexes[i] = rowType.indexOf(readColumns.get(i));\n                fields[i] = rowType.getFieldName(indexes[i]);\n                types[i] = rowType.getFieldType(indexes[i]);\n            }\n            this.seaTunnelRowType = new SeaTunnelRowType(fields, types);\n            this.seaTunnelRowTypeWithPartition =\n                    mergePartitionTypes(partitionPath, this.seaTunnelRowType);\n        }\n    }\n\n    @SneakyThrows","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/XmlReadStrategy.java#L224-L260","documentation":"XmlReadStrategy.setCatalogTable intersects the user-configured read_columns list with the field names of the schema (catalog table row type). If retainAll removed any columns — meaning read_columns was not a subset of the schema — it logs this warning and proceeds with only the surviving columns. The read result will silently contain fewer columns than the user asked for.","triggerScenarios":"Calling setCatalogTable (via createXmlReadStrategy) with a read_columns config containing column names that do not appear in the schema's field names; e.g. typos, case mismatches, or columns that exist in the XML file but were excluded from the schema block.","commonSituations":"User defines schema in the job config but lists read_columns from an older file layout; column name casing differs between config and schema; copy-paste of read_columns from another table's job.","solutions":["Align read_columns to be an exact subset of the schema field names (same names and casing)","Or remove read_columns entirely so the reader uses all schema columns","Regenerate the schema block from the actual XML structure, then re-derive read_columns from it"],"exampleFix":"// before\nschema = { fields { id INT, name STRING } }\nread_columns = [\"id\", \"Name\"]\n// after\nschema = { fields { id INT, name STRING } }\nread_columns = [\"id\", \"name\"]","handlingStrategy":"validation","validationCode":"// Validate read_columns is a subset of schema fields before creating the reader\njava.util.List<String> readColumns =\n        new java.util.ArrayList<>(java.util.Arrays.asList(configReadColumns));\njava.util.List<String> schemaFields = java.util.Arrays.asList(rowType.getFieldNames());\nif (!schemaFields.containsAll(readColumns)) {\n    throw new IllegalArgumentException(\n            \"read_columns must be a subset of schema fields; schema=\" + schemaFields\n                    + \", read_columns=\" + readColumns);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate read_columns directly from the schema field names to guarantee a subset","Watch for name casing differences between config, schema, and XML file","If a column is missing from the schema, decide explicitly: add it to schema or drop it from read_columns"],"tags":["file-connector","xml","schema-mismatch","config-validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}