{"record":{"id":"ee53fed8b2d8e19e","repo":"MyCATApache/Mycat-Server","slug":"columnvalue-columnvalue-please-check-if-the-form-ee53fe","errorCode":null,"errorMessage":"columnValue:{columnValue} Please check if the format satisfied.","messagePattern":"columnValue:(.+?) Please check if the format satisfied\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/route/function/PartitionByFileMap.java","lineNumber":98,"sourceCode":"\t}\r\n\r\n\t@Override\r\n\tpublic Integer calculate(String columnValue)  {\r\n\t\ttry {\r\n\t\t\tObject value = columnValue;\r\n\t\t\tif (type == 0) {\r\n\t\t\t\tvalue = Integer.valueOf(columnValue);\r\n\t\t\t}\r\n\t\t\tInteger rst = null;\r\n\t\t\tInteger pid = app2Partition.get(value);\r\n\t\t\tif (pid != null) {\r\n\t\t\t\trst = pid;\r\n\t\t\t} else {\r\n\t\t\t\trst = app2Partition.get(DEFAULT_NODE);\r\n\t\t\t}\r\n\t\t\treturn rst;\r\n\t\t} catch (NumberFormatException e){\r\n\t\t\tthrow new IllegalArgumentException(new StringBuilder().append(\"columnValue:\").append(columnValue).append(\" Please check if the format satisfied.\").toString(),e);\r\n\t\t}\r\n\t}\r\n\t\r\n\t@Override\r\n\tpublic int getPartitionNum() {\r\n\t\tSet<Integer> set = new HashSet<Integer>(app2Partition.values());\r\n\t\tint count = set.size();\r\n\t\treturn count;\r\n\t}\r\n\r\n\tprivate void initialize() {\r\n\t\tBufferedReader in = null;\r\n\t\ttry {\r\n\t\t\t// FileInputStream fin = new FileInputStream(new File(fileMapPath));\r\n\t\t\tInputStream fin = this.getClass().getClassLoader()\r\n\t\t\t\t\t.getResourceAsStream(mapFile);\r\n\t\t\tif (fin == null) {\r\n\t\t\t\tthrow new RuntimeException(\"can't find class resource file \"\r","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/route/function/PartitionByFileMap.java#L80-L116","documentation":"PartitionByFileMap.calculate() looks up the column value in app2Partition (loaded from mapFile). Although the map keys are Objects, this catch triggers when numeric parsing of the column value throws NumberFormatException, meaning the value cannot be interpreted/matched to a configured partition entry. The library then throws this IllegalArgumentException.","triggerScenarios":"Routing a row whose partition (map) column value is a non-numeric string that fails Number parsing in calculate(); value not present and DEFAULT_NODE resolution path still requires parsing; passing values like '12a' or quoted numbers.","commonSituations":"Map file in rule config lists integer keys but the application sends string keys; values contain quotes or whitespace; type of the sharding column in the table doesn't match the keys configured in the map file.","solutions":["Ensure the column value is a valid number matching keys in the map file, or add the actual value to the map file.","Configure a defaultNode so unmapped values route somewhere instead of failing parse paths.","Strip quotes/non-numeric characters from the value at the application or ETL layer before insert."],"exampleFix":"// before\nINSERT INTO t(id, type) VALUES(1, '\"3\"'); // quoted value\n// after\nINSERT INTO t(id, type) VALUES(1, '3');","handlingStrategy":"validation","validationCode":"boolean ok = columnValue != null && columnValue.trim().matches(\"-?\\\\d+\");\n","typeGuard":null,"tryCatchPattern":"try {\n    Integer node = partitionByFileMap.calculate(columnValue);\n} catch (IllegalArgumentException e) {\n    // fall back to defaultNode or reject with clear error\n}","preventionTips":["Keep map file keys and column data types aligned (all numeric)","Strip quotes/whitespace from values in the app layer","Configure defaultNode for unmapped values"],"tags":["sharding","number-format","parsing"],"backgroundTag":"invalid-argument-format","analyzedSha":"65f8d8beb752f935752f2a0eec0ab017facab9ef","analyzedAt":"2026-09-11T00:12:21.696Z","contentChangedAt":"2026-09-11T00:12:21.696Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}