{"record":{"id":"0def382e078d09cb","repo":"apache/seatunnel","slug":"the-decimal-column-type-decimal-is-out-o-0def38","errorCode":null,"errorMessage":"The decimal column {} type decimal({},{}) is out of range, which is precision less than 0, it will be converted to decimal({},{})","messagePattern":"The decimal column (.+?) type decimal\\((.+?),(.+?)\\) is out of range, which is precision less than 0, it will be converted to decimal\\((.+?),(.+?)\\)","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/phoenix/PhoenixTypeConverter.java","lineNumber":212,"sourceCode":"                builder.columnType(PHOENIX_BIGINT);\n                builder.dataType(PHOENIX_BIGINT);\n                break;\n            case FLOAT:\n                builder.columnType(PHOENIX_FLOAT);\n                builder.dataType(PHOENIX_FLOAT);\n                break;\n            case DOUBLE:\n                builder.columnType(PHOENIX_DOUBLE);\n                builder.dataType(PHOENIX_DOUBLE);\n                break;\n            case DECIMAL:\n                DecimalType decimalType = (DecimalType) column.getDataType();\n                long precision = decimalType.getPrecision();\n                int scale = decimalType.getScale();\n                if (precision <= 0) {\n                    precision = DEFAULT_PRECISION;\n                    scale = DEFAULT_SCALE;\n                    log.warn(\n                            \"The decimal column {} type decimal({},{}) is out of range, \"\n                                    + \"which is precision less than 0, \"\n                                    + \"it will be converted to decimal({},{})\",\n                            column.getName(),\n                            decimalType.getPrecision(),\n                            decimalType.getScale(),\n                            precision,\n                            scale);\n                } else if (precision > MAX_PRECISION) {\n                    scale = (int) Math.max(0, scale - (precision - MAX_PRECISION));\n                    precision = MAX_PRECISION;\n                    log.warn(\n                            \"The decimal column {} type decimal({},{}) is out of range, \"\n                                    + \"which exceeds the maximum precision of {}, \"\n                                    + \"it will be converted to decimal({},{})\",\n                            column.getName(),\n                            decimalType.getPrecision(),\n                            decimalType.getScale(),","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/phoenix/PhoenixTypeConverter.java#L194-L230","documentation":"When converting a SeaTunnel DecimalType column back to the Phoenix JDBC type, the converter validates the decimal precision. A precision of 0 or less is invalid for Phoenix DECIMAL columns, so the converter does not throw; it logs this warning and silently substitutes the default precision/scale (DEFAULT_PRECISION/DEFAULT_SCALE). Data written afterward uses the substituted type, which may lose the intended schema fidelity.","triggerScenarios":"Calling PhoenixTypeConverter.reconvert() (via the Phoenix dialect's toConnectorType/convert paths) on a CatalogColumn whose DecimalType has precision <= 0, e.g. a decimal built programmatically or read from a source that reports precision 0.","commonSituations":"Catalog columns populated by custom sources or auto-generated schemas where decimal precision was never set (defaulting to 0); upstream schema inference returning precision 0 for numeric columns.","solutions":["Fix the upstream source/schema so the decimal precision is a positive value (e.g. DECIMAL(10,2) instead of DECIMAL(0,0)).","If precision is genuinely unknown, explicitly declare the column with a concrete precision in your SeaTunnel config or catalog table before it reaches the Phoenix sink.","Review the warning log to identify which column is affected and confirm the default decimal (DEFAULT_PRECISION/DEFAULT_SCALE) is acceptable for your data.","If you need different defaults, adjust/override DEFAULT_PRECISION and DEFAULT_SCALE in PhoenixTypeConverter."],"exampleFix":"// before (source schema)\ncatalogColumn = CatalogColumn.of(\"amount\", DecimalType(0, 0));\n// after\ncatalogColumn = CatalogColumn.of(\"amount\", new DecimalType(10, 2));","handlingStrategy":"validation","validationCode":"CatalogColumn col = ...;\nDecimalType dt = (DecimalType) col.getDataType();\nif (dt.getPrecision() <= 0) {\n    col = CatalogColumn.of(col.getName(), new DecimalType(10, 2), col.isNullable(), col.getDefaultValue());\n}","typeGuard":"boolean isValidDecimal(CatalogColumn c) {\n    return c.getDataType() instanceof DecimalType\n        && ((DecimalType) c.getDataType()).getPrecision() > 0;\n}","tryCatchPattern":null,"preventionTips":["Always declare decimal columns with explicit positive precision","Validate source schemas before running pipelines","Watch for log.warn output about decimal conversion during dev runs","Pin precision/scale in catalog definitions rather than relying on inference"],"tags":["jdbc","phoenix","decimal","type-conversion","schema"],"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"}