{"record":{"id":"fbca5ce86e39b039","repo":"apache/flink","slug":"the-quality-of-field-type-is-incompatible-with-the-fbca5c","errorCode":null,"errorMessage":"The quality of field type is incompatible with the request schema!","messagePattern":"The quality of field type is incompatible with the request schema!","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/vector/ParquetColumnarRowSplitReader.java","lineNumber":230,"sourceCode":"\n    /**\n     * Create readable vectors from writable vectors. Especially for decimal, see {@link\n     * ParquetDecimalVector}.\n     */\n    private ColumnVector[] createReadableVectors() {\n        ColumnVector[] vectors = new ColumnVector[writableVectors.length];\n        for (int i = 0; i < writableVectors.length; i++) {\n            vectors[i] =\n                    selectedTypes[i].getTypeRoot() == LogicalTypeRoot.DECIMAL\n                            ? new ParquetDecimalVector(writableVectors[i])\n                            : writableVectors[i];\n        }\n        return vectors;\n    }\n\n    private void checkSchema() throws IOException, UnsupportedOperationException {\n        if (selectedTypes.length != requestedSchema.getFieldCount()) {\n            throw new RuntimeException(\n                    \"The quality of field type is incompatible with the request schema!\");\n        }\n\n        /*\n         * Check that the requested schema is supported.\n         */\n        for (int i = 0; i < requestedSchema.getFieldCount(); ++i) {\n            String[] colPath = requestedSchema.getPaths().get(i);\n            if (fileSchema.containsPath(colPath)) {\n                ColumnDescriptor fd = fileSchema.getColumnDescription(colPath);\n                if (!fd.equals(requestedSchema.getColumns().get(i))) {\n                    throw new UnsupportedOperationException(\"Schema evolution not supported.\");\n                }\n            } else {\n                if (requestedSchema.getColumns().get(i).getMaxDefinitionLevel() == 0) {\n                    // Column is missing in data but the required data is non-nullable. This file is\n                    // invalid.\n                    throw new IOException(","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/vector/ParquetColumnarRowSplitReader.java#L212-L248","documentation":"RuntimeException from checkSchema() in ParquetColumnarRowSplitReader: the number of clipped types (selectedTypes, produced by clipping the requested fields against the file schema) does not equal the requested schema's field count. It signals an internal inconsistency between the requested schema that was built (Types.buildMessage().addFields(types)) and the requestedSchema message, typically caused by duplicate requested field names or an unsupported nested-type clipping (the code carries a 'TODO clip for array,map,row types').","triggerScenarios":"Constructing ParquetColumnarRowSplitReader where requestedSchema (built from the types[] array) ends up with a different field count than selectedTypes.length - e.g. requested fields that collapse to the same physical column, or nested array/map/row types that the clip logic does not fully expand.","commonSituations":"Tables with duplicate column names after case folding in the requested projection; reading deeply nested array/map/row columns in older Flink versions where clipping of nested types was incomplete; mixed schemas where some requested fields resolve and others do not.","solutions":["Remove duplicate columns (exact or case-insensitive) from the requested schema/projection","If the file has case-duplicate columns, normalize them first (see the case-insensitive duplicate-key error)","Upgrade Flink - nested type clipping for array/map/row has been progressively fixed; pick a version where your nested schema is supported","Flatten or simplify nested row/array/map columns in the source files if the version cannot clip them"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before building the reader, assert the requested projection has unique names\nSet<String> low = new HashSet<>();\nfor (String f : fieldNames) { if (!low.add(f.toLowerCase(Locale.ROOT))) throw new IllegalStateException(\"Duplicate requested field: \" + f); }\nassert fieldNames.length == selectedTypes.length;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never define tables with case-duplicate column names","Test nested array/map/row projections against your Flink version before production"],"tags":["parquet","schema","internal-invariant","flink"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}