{"record":{"id":"0349b8ff78133039","repo":"apache/seatunnel","slug":"decimal-precision-incompatible","errorCode":"DECIMAL_PRECISION_INCOMPATIBLE","errorMessage":"`%s` field value is: %s, except field schema of sink is %s, but the field in sink table with actual schema is %s. Please check the schema of the sink table.","messagePattern":"`(.+?)` field value is: (.+?), except field schema of sink is (.+?), but the field in sink table with actual schema is (.+?)\\. Please check the schema of the sink table\\.","errorType":"error_code","errorClass":"PaimonConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/utils/RowConverter.java","lineNumber":594,"sourceCode":"                    || sinkDecimalType.getScale() < sourceDecimalType.getScale()) {\n                throw CommonError.writeRowErrorWithSchemaIncompatibleSchema(\n                        PaimonBaseOptions.CONNECTOR_IDENTITY,\n                        sourceFieldName + StringUtils.SPACE + sourceFieldType.getSqlType(),\n                        exceptDataField.asSQLString(),\n                        sinkDataField.asSQLString());\n            }\n            BigDecimal bd =\n                    ((BigDecimal) fieldValue)\n                            .setScale(sinkDecimalType.getScale(), RoundingMode.HALF_UP);\n            if (bd.precision() > sinkDecimalType.getPrecision()) {\n                String message =\n                        String.format(\n                                \"`%s` field value is: %s, except field schema of sink is %s, but the field in sink table with actual schema is %s. Please check the schema of the sink table.\",\n                                sourceFieldName,\n                                fieldValue,\n                                exceptDataField.asSQLString(),\n                                sinkDataField.asSQLString());\n                throw new PaimonConnectorException(\n                        PaimonConnectorErrorCode.DECIMAL_PRECISION_INCOMPATIBLE, message);\n            }\n        }\n    }\n}\n","sourceCodeStart":576,"sourceCodeEnd":600,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/utils/RowConverter.java#L576-L600","documentation":"RowConverter.checkCanWriteWithSchema (via reconvert) validates each incoming field's value against the sink table's DataField schema. When a DECIMAL field's value precision/scale does not fit the sink table's declared DecimalType, it throws PaimonConnectorException with DECIMAL_PRECISION_INCOMPATIBLE.","triggerScenarios":"Writing rows via the Paimon sink where a decimal source column has larger precision or different scale than the corresponding Paimon sink table column.","commonSituations":"Sink table created with DECIMAL(10,2) but upstream emits DECIMAL(20,2); schema mismatch after upstream DDL change; type-conversion chains that widen decimals before the sink.","solutions":["Alter the Paimon sink table column to a precision/scale that accommodates source data","Cast/truncate the decimal in an upstream transform to match the sink schema","Align source and sink schemas so both declare identical decimal definitions"],"exampleFix":"// before\nsink { Paimon { schema = { field { amount = \"decimal(10,2)\" } } } } // source emits decimal(20,2)\n// after\nsink { Paimon { schema = { field { amount = \"decimal(20,2)\" } } } }","handlingStrategy":"validation","validationCode":"if (sourceType.getPrecision() > sinkType.getPrecision() || sourceType.getScale() != sinkType.getScale()) {\n    throw new IllegalStateException(\"Decimal mismatch: source \" + sourceType.asSQLString() + \" vs sink \" + sinkType.asSQLString());\n}","typeGuard":"boolean decimalCompatible(DecimalType src, DecimalType sink) { return src.getPrecision() <= sink.getPrecision() && src.getScale() == sink.getScale(); }","tryCatchPattern":"try { rowConverter.reconvert(row); } catch (PaimonConnectorException e) { if (PaimonConnectorErrorCode.DECIMAL_PRECISION_INCOMPATIBLE.equals(e.getErrorCode())) { LOG.error(\"Align sink decimal schema\"); } throw e; }","preventionTips":["Keep sink decimal precision >= source and scale identical","Validate schemas with a dry-run before production writes","Monitor upstream DDL changes that widen decimals"],"tags":["paimon","decimal","schema-mismatch"],"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-23T08:17:48.524Z"}