{"record":{"id":"902dd984ab6fa888","repo":"apache/seatunnel","slug":"decimal-precision-exceeds-maximum-truncatin","errorCode":null,"errorMessage":"DECIMAL precision {} exceeds maximum {}, truncating to {}","messagePattern":"DECIMAL precision (.+?) exceeds maximum (.+?), truncating to (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/duckdb/DuckDBTypeConverter.java","lineNumber":200,"sourceCode":"                builder.dataType(BasicType.STRING_TYPE);\n                builder.columnLength(lengthValue > 0 ? lengthValue : 65535);\n                break;\n            default:\n                log.warn(\"Unsupported DuckDB type: {}, falling back to STRING\", duckDBType);\n                builder.dataType(BasicType.STRING_TYPE);\n                builder.columnLength(lengthValue > 0 ? lengthValue : 255);\n        }\n        return builder.build();\n    }\n\n    private void handleDecimalType(\n            PhysicalColumn.PhysicalColumnBuilder builder, BasicTypeDefine typeDefine) {\n        long precision =\n                typeDefine.getPrecision() != null ? typeDefine.getPrecision() : DEFAULT_PRECISION;\n        int scale = typeDefine.getScale() != null ? typeDefine.getScale() : DEFAULT_SCALE;\n\n        if (precision > MAX_PRECISION) {\n            log.warn(\n                    \"DECIMAL precision {} exceeds maximum {}, truncating to {}\",\n                    precision,\n                    MAX_PRECISION,\n                    MAX_PRECISION);\n            precision = MAX_PRECISION;\n        }\n        if (scale < 0) {\n            log.warn(\"DECIMAL scale {} is negative, setting to 0\", scale);\n            scale = 0;\n        } else if (scale > MAX_SCALE) {\n            log.warn(\n                    \"DECIMAL scale {} exceeds maximum {}, truncating to {}\",\n                    scale,\n                    MAX_SCALE,\n                    MAX_SCALE);\n            scale = MAX_SCALE;\n        }\n","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/duckdb/DuckDBTypeConverter.java#L182-L218","documentation":"Warning from DuckDBTypeConverter.handleDecimalType (via convert): the source DECIMAL's precision exceeds MAX_PRECISION supported by the DuckDB dialect, so precision is truncated to MAX_PRECISION. The converted column will declare the reduced precision, which can cause rounding or write failures if actual values need more digits.","triggerScenarios":"Calling convert on a BasicTypeDefine with getPrecision() > the dialect's MAX_PRECISION (e.g. DECIMAL(40,10) from a source table).","commonSituations":"Syncing DECIMAL columns from engines that allow larger precision (e.g. some sources allow up to 38+ or unbounded) into DuckDB via catalog-driven schema mapping.","solutions":["Cast the source column to a precision within the dialect maximum, e.g. CAST(col AS DECIMAL(38,6)).","Raise the sink column definition manually if you control schema creation.","Verify actual data range; if values never approach the max, the truncation is harmless.","Upgrade the connector if a newer version supports higher precision."],"exampleFix":"// before\nSELECT amount FROM ledger; -- DECIMAL(45,10)\n// after\nSELECT CAST(amount AS DECIMAL(38,10)) AS amount FROM ledger;","handlingStrategy":"validation","validationCode":"for (Column c : columns) {\n  if (c.getDataType() instanceof DecimalType) {\n    long p = ((DecimalType) c.getDataType()).getPrecision();\n    if (p > MAX_PRECISION) throw new IllegalArgumentException(\n      \"Column \" + c.getName() + \" precision \" + p + \" exceeds \" + MAX_PRECISION);\n  }\n}","typeGuard":"boolean isDuckDbSafeDecimal(DecimalType t) {\n  return t.getPrecision() > 0 && t.getPrecision() <= MAX_PRECISION;\n}","tryCatchPattern":null,"preventionTips":["CAST oversized decimals at the source query to the dialect max precision.","Audit source schemas for DECIMAL with precision > 38 before cross-engine syncs.","Pre-create sink tables with intentional precision instead of auto mapping."],"tags":["jdbc","duckdb","decimal","precision"],"backgroundTag":"value-out-of-range","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}