apache/seatunnel · error · PaimonConnectorException

DECIMAL_PRECISION_INCOMPATIBLE

DECIMAL_PRECISION_INCOMPATIBLE

Error message

`%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.

What it means

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.

Solutions

  1. Alter the Paimon sink table column to a precision/scale that accommodates source data
  2. Cast/truncate the decimal in an upstream transform to match the sink schema
  3. Align source and sink schemas so both declare identical decimal definitions

Example fix

// before
sink { Paimon { schema = { field { amount = "decimal(10,2)" } } } } // source emits decimal(20,2)
// after
sink { Paimon { schema = { field { amount = "decimal(20,2)" } } } }
Defensive patterns

Strategy: validation

Validate before calling

if (sourceType.getPrecision() > sinkType.getPrecision() || sourceType.getScale() != sinkType.getScale()) {
    throw new IllegalStateException("Decimal mismatch: source " + sourceType.asSQLString() + " vs sink " + sinkType.asSQLString());
}

Type guard

boolean decimalCompatible(DecimalType src, DecimalType sink) { return src.getPrecision() <= sink.getPrecision() && src.getScale() == sink.getScale(); }

Try / catch

try { rowConverter.reconvert(row); } catch (PaimonConnectorException e) { if (PaimonConnectorErrorCode.DECIMAL_PRECISION_INCOMPATIBLE.equals(e.getErrorCode())) { LOG.error("Align sink decimal schema"); } throw e; }

Prevention

When it happens

Trigger: Writing rows via the Paimon sink where a decimal source column has larger precision or different scale than the corresponding Paimon sink table column.

Common situations: 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.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/0349b8ff78133039. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/utils/RowConverter.java:594

                    || sinkDecimalType.getScale() < sourceDecimalType.getScale()) {
                throw CommonError.writeRowErrorWithSchemaIncompatibleSchema(
                        PaimonBaseOptions.CONNECTOR_IDENTITY,
                        sourceFieldName + StringUtils.SPACE + sourceFieldType.getSqlType(),
                        exceptDataField.asSQLString(),
                        sinkDataField.asSQLString());
            }
            BigDecimal bd =
                    ((BigDecimal) fieldValue)
                            .setScale(sinkDecimalType.getScale(), RoundingMode.HALF_UP);
            if (bd.precision() > sinkDecimalType.getPrecision()) {
                String message =
                        String.format(
                                "`%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.",
                                sourceFieldName,
                                fieldValue,
                                exceptDataField.asSQLString(),
                                sinkDataField.asSQLString());
                throw new PaimonConnectorException(
                        PaimonConnectorErrorCode.DECIMAL_PRECISION_INCOMPATIBLE, message);
            }
        }
    }
}

View on GitHub (pinned to cf67b549a7)