{"record":{"id":"1e20ea1af5c1f388","repo":"MyCATApache/Mycat-Server","slug":"columnvalue-columnvalue-please-check-if-the-form-1e20ea","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/PartitionByMonth.java","lineNumber":133,"sourceCode":"            targetPartition = ((curTime.get(Calendar.YEAR) - beginDate.get(Calendar.YEAR))\n                * 12 + curTime.get(Calendar.MONTH)\n                - beginDate.get(Calendar.MONTH));\n\n            /**\n             * For circulatory partition, calculated value of target partition needs to be\n             * rotated to fit the partition range\n             */\n            if (nPartition > 0) {\n                targetPartition = reCalculatePartition(targetPartition);\n            }\n            // 防止越界的情况\n            if (targetPartition < 0) {\n                targetPartition = 0;\n            }\n            return targetPartition;\n\n        } catch (ParseException e) {\n            throw new IllegalArgumentException(new StringBuilder().append(\"columnValue:\").append(columnValue)\n                .append(\" Please check if the format satisfied.\").toString(), e);\n        }\n    }\n\n    @Override\n    public Integer[] calculateRange(String beginValue, String endValue) {\n        try {\n            return doCalculateRange(beginValue, endValue, beginDate);\n        } catch (ParseException e) {\n            LOGGER.error(\"error\", e);\n            return new Integer[0];\n        }\n    }\n\n    private Integer[] doCalculateRange(String beginValue, String endValue, Calendar beginDate) throws ParseException {\n        int startPartition, endPartition;\n        Calendar partitionTime = Calendar.getInstance();\n        SimpleDateFormat format = new SimpleDateFormat(dateFormat);","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/route/function/PartitionByMonth.java#L115-L151","documentation":"PartitionByMonth.calculate() parses the column value as a date to derive a month-based partition. When SimpleDateFormat throws ParseException, this IllegalArgumentException is raised. The value must match the configured dateFormat (default yyyy-MM-dd) for the month partition to be computed.","triggerScenarios":"calculate() (also reached via test() and sence1()) receiving a value unparseable by the configured dateFormat: wrong order (dd-MM-yyyy), embedded time when pattern lacks it, empty or malformed strings.","commonSituations":"Monthly sharding rules where the app writes full timestamps but the rule expects date-only strings; locale-specific formats; values like '20240101' without separators.","solutions":["Set the dateFormat property to match the actual column format exactly.","Normalize the column value before it reaches the router (application-side reformatting).","Catch IllegalArgumentException in the query path and reject malformed dates with a clear client error."],"exampleFix":"// before (dateFormat yyyy-MM-dd)\nINSERT INTO t(id, m) VALUES(1, '01-2024-15');\n// after\nINSERT INTO t(id, m) VALUES(1, '2024-01-15');","handlingStrategy":"validation","validationCode":"boolean valid;\ntry {\n  new java.text.SimpleDateFormat(dateFormat).parse(columnValue);\n  valid = true;\n} catch (java.text.ParseException e) { valid = false; }\n","typeGuard":null,"tryCatchPattern":"try {\n    Integer node = partitionByMonth.calculate(columnValue);\n} catch (IllegalArgumentException e) {\n    // malformed month-column value; log value and dateFormat, reject query\n}","preventionTips":["Pin an explicit dateFormat in rule.xml, never rely on defaults","Use zero-padded yyyy-MM-dd everywhere","Test calculate() with values from all writer services"],"tags":["sharding","date-format","parsing"],"backgroundTag":"invalid-date-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"}