{"record":{"id":"756b6d5efc2b00d9","repo":"apache/seatunnel","slug":"invalid-decimal-definition-decimaltypedefinit","errorCode":null,"errorMessage":"Invalid DECIMAL definition: \" + decimalTypeDefinition","messagePattern":"Invalid DECIMAL definition: \" \\+ decimalTypeDefinition","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-starrocks/src/main/java/org/apache/seatunnel/connectors/seatunnel/starrocks/datatypes/StarRocksTypeConverter.java","lineNumber":492,"sourceCode":"\n        if (columnType.contains(\"(\") && columnType.contains(\")\")) {\n            return columnType.substring(0, columnType.indexOf(\"(\"));\n        }\n\n        return columnType;\n    }\n\n    private static int[] getPrecisionAndScale(String decimalTypeDefinition) {\n        // Remove the \"DECIMALV3\" part and the parentheses\n        decimalTypeDefinition = decimalTypeDefinition.toUpperCase(Locale.ROOT);\n        String numericPart = decimalTypeDefinition.replace(\"DECIMALV3(\", \"\").replace(\")\", \"\");\n        numericPart = numericPart.replace(\"DECIMAL(\", \"\").replace(\")\", \"\");\n\n        // Split by comma to separate precision and scale\n        String[] parts = numericPart.split(\",\");\n\n        if (parts.length != 2) {\n            throw new IllegalArgumentException(\n                    \"Invalid DECIMAL definition: \" + decimalTypeDefinition);\n        }\n\n        // Parse precision and scale from the split parts\n        int precision = Integer.parseInt(parts[0].trim());\n        int scale = Integer.parseInt(parts[1].trim());\n\n        // Return an array containing precision and scale\n        return new int[] {precision, scale};\n    }\n\n    private void reconvertBuildArrayInternal(\n            SeaTunnelDataType elementType,\n            BasicTypeDefine.BasicTypeDefineBuilder<StarRocksType> builder,\n            String columnName) {\n        switch (elementType.getSqlType()) {\n            case BOOLEAN:\n                builder.columnType(SR_BOOLEAN_ARRAY);","sourceCodeStart":474,"sourceCodeEnd":510,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-starrocks/src/main/java/org/apache/seatunnel/connectors/seatunnel/starrocks/datatypes/StarRocksTypeConverter.java#L474-L510","documentation":"StarRocksTypeConverter.getPrecisionAndScale parses a DECIMAL type definition of the form 'DECIMAL(p,s)' by stripping the prefix, splitting on comma, and requiring exactly two parts. If the string doesn't yield exactly two parts, it throws IllegalArgumentException('Invalid DECIMAL definition: ...').","triggerScenarios":"Passing a malformed decimalTypeDefinition such as 'DECIMAL(10)' (missing scale), 'DECIMAL' (no parentheses), 'DECIMAL(10,2,3)', or a variant whose numeric part doesn't split into exactly two comma-separated integers.","commonSituations":"Custom save_mode_create_template producing non-standard DECIMAL DDL (e.g. DECIMAL without scale); table definitions written by hand or by other tools with invalid precision/syntax; case/spacing variants the parser doesn't normalize.","solutions":["Fix the DECIMAL definition to StarRocks canonical form DECIMAL(precision, scale), e.g. DECIMAL(10,2)","If it comes from save_mode_create_template, correct the template's decimal syntax","Check the source table DDL in StarRocks (SHOW CREATE TABLE) and match it exactly","If this is user input validation, pre-validate the decimal string before conversion"],"exampleFix":"// before\nString ddl = \"DECIMAL(10)\"; // missing scale\n// after\nString ddl = \"DECIMAL(10,2)\";","handlingStrategy":"validation","validationCode":"String ct = \"DECIMAL(10,2)\"; assert ct.toUpperCase().matches(\"DECIMAL\\\\s*\\\\(\\\\s*\\\\d+\\\\s*,\\\\s*\\\\d+\\\\s*\\\\)\"); // passes only canonical form","typeGuard":"boolean isValidDecimalDef(String s) { return s != null && s.toUpperCase(Locale.ROOT).matches(\"DECIMAL\\\\s*\\\\(\\\\s*\\\\d+\\\\s*,\\\\s*\\\\d+\\\\s*\\\\)\"); }","tryCatchPattern":"try { converter.convert(td); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Invalid DECIMAL definition\")) { /* normalize the DDL to DECIMAL(p,s) and retry */ } throw e; }","preventionTips":["Keep save_mode_create_template DECIMAL syntax canonical: DECIMAL(p,s)","Compare with SHOW CREATE TABLE output when syncing schemas","Pre-validate user-supplied DDL templates"],"tags":["starrocks","type-converter","decimal","parsing"],"backgroundTag":"invalid-argument-format","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"}