{"record":{"id":"6d1d3a4b1a8ae523","repo":"MyCATApache/Mycat-Server","slug":"columnvalue-columnvalue-please-check-if-the-form-6d1d3a","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/PartitionByHotDate.java","lineNumber":81,"sourceCode":"\t\tInteger targetPartition = -1;\n\t\ttry {\n\t\t\tlong targetTime = formatter.get().parse(columnValue).getTime();\n\t\t\tCalendar now = Calendar.getInstance();\n\t\t\tlong nowTime = now.getTimeInMillis();\n\t\t\t\n\t\t\tbeginDate = nowTime - sLastTime * oneDay;\n\t\t\t\n\t\t\tlong diffDays = (nowTime - targetTime) / (1000 * 60 * 60 * 24) + 1;\n\t\t\tif(diffDays-sLastTime <= 0 || diffDays<0 ){\n\t\t\t\ttargetPartition = 0;\n\t\t\t}else{\n\t\t\t\ttargetPartition = (int) ((beginDate - targetTime) / partionTime) + 1;\n\t\t\t}\n\t\t\t\n\t\t    LOGGER.debug(\"PartitionByHotDate calculate for \" + columnValue + \" return \" + targetPartition);\n\t\t\treturn targetPartition;\n\t\t} catch (ParseException e) {\n\t\t\tthrow new IllegalArgumentException(new StringBuilder().append(\"columnValue:\").append(columnValue).append(\" Please check if the format satisfied.\").toString(),e);\n\t\t}\n\t}\n\n\t@Override\n\tpublic Integer[] calculateRange(String beginValue, String endValue)  {\n\t\tInteger[] targetPartition = null;\n\t\ttry {\n\t\t\tlong startTime = formatter.get().parse(beginValue).getTime();\n\t\t\tlong endTime = formatter.get().parse(endValue).getTime();\n\t\t\tCalendar now = Calendar.getInstance();\n\t\t\tlong nowTime = now.getTimeInMillis();\n\t\t\t\n\t\t\tlong limitDate = nowTime - sLastTime * oneDay;\n\t\t\tlong diffDays = (nowTime - startTime) / (1000 * 60 * 60 * 24) + 1;\n\t\t\tif(diffDays-sLastTime <= 0 || diffDays<0 ){\n\t\t\t\tInteger [] re = new Integer[1];\n\t\t\t\tre[0] = 0;\n\t\t\t\ttargetPartition = re ;","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/route/function/PartitionByHotDate.java#L63-L99","documentation":"PartitionByHotDate.calculate() parses the column value as a date (SimpleDateFormat) to compute a 'hot' time-based partition. On ParseException it throws this IllegalArgumentException with the offending columnValue. The value's format does not match the configured date format.","triggerScenarios":"calculate() receiving a column value that fails parsing: wrong date pattern vs dateFormat config, empty string, garbage text, or timestamp format differing from expectation; reached via calculateRange() and test() as well.","commonSituations":"Applications inserting 'yyyy-MM-dd HH:mm:ss' while the rule expects 'yyyy-MM-dd' (or vice versa); nulls converted to string 'null'; regional date orders (dd/MM vs MM/dd).","solutions":["Align dateFormat property with the actual format of the column values.","Normalize the value before insert (e.g. strip time or reformat) in the application.","Catch IllegalArgumentException in the SQL path and surface a clear client-side validation error."],"exampleFix":"// before (rule dateFormat yyyy-MM-dd, data with time)\nINSERT INTO t(id, dt) VALUES(1, '2024-01-01 10:00:00');\n// after\nINSERT INTO t(id, dt) VALUES(1, '2024-01-01');","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 = partitionByHotDate.calculate(columnValue);\n} catch (IllegalArgumentException e) {\n    // inspect offending value logged inside the message\n}","preventionTips":["Match dateFormat to actual stored format before enabling the rule","Reject or normalize bad dates at the API boundary","Cover calculate() with tests for every date format the app emits"],"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"}