MyCATApache/Mycat-Server · error · IllegalArgumentException
columnValue: Please check if the format satisfied.
Error message
columnValue:{columnValue} Please check if the format satisfied. What it means
PartitionByMonthAndHistory.calculate() parses the column value as a date (SimpleDateFormat) to compute a month partition with history-aware recalculation (reCalculatePartition). On ParseException it throws this IllegalArgumentException. The column value must be a date string in the configured format.
Solutions
- Make all column values conform to the configured dateFormat (reformat legacy data if needed).
- Update the dateFormat property to the dominant data format.
- Add pre-insert validation that the value parses with the same SimpleDateFormat before sending to Mycat.
Example fix
// before (mixed formats in data) INSERT INTO t(id, d) VALUES(1, '2024-1-5'); // after INSERT INTO t(id, d) VALUES(1, '2024-01-05');
Defensive patterns
Strategy: validation
Validate before calling
boolean valid;
try {
new java.text.SimpleDateFormat(dateFormat).parse(columnValue);
valid = true;
} catch (java.text.ParseException e) { valid = false; }
Try / catch
try {
Integer node = partitionByMonthAndHistory.calculate(columnValue);
} catch (IllegalArgumentException e) {
// malformed date for history-month routing; quarantine row and log value
} Prevention
- Migrate legacy rows to the canonical date format before enabling the rule
- Validate dates in ETL pipelines with the same pattern
- Keep one shared date-formatter utility across services
When it happens
Trigger: calculate() receiving a value that fails date parsing: format mismatch with the rule's dateFormat, empty/null string, or non-date text; history partition routing of migrated rows with nonstandard date formats.
Common situations: History-month sharding where legacy data uses a different date format than new data; applications formatting dates per locale; timezone-adjusted strings with offsets not matching the pattern.
Related errors
- columnValue: Please check if the format satisfied.
- columnValue: Please check if the format satisfied.
- columnValue: Please check if the format satisfied.
- columnValue: Please check if the format satisfied.
- columnValue: Please check if the format satisfied.
AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11).
Data as JSON: /api/errors/eb57334c7afd23ef.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/io/mycat/route/function/PartitionByMonthAndHistory.java:102
try {
int targetPartition;
Calendar curTime = Calendar.getInstance();
curTime.setTime(formatter.get().parse(columnValue));
targetPartition = ((curTime.get(Calendar.YEAR) - beginDate.get(Calendar.YEAR))
* 12 + curTime.get(Calendar.MONTH)
- beginDate.get(Calendar.MONTH));
/**
* For circulatory partition, calculated value of target partition needs to be
* rotated to fit the partition range
*/
if (nPartition > 0) {
targetPartition = reCalculatePartition(targetPartition);
}
return targetPartition;
} catch (ParseException e) {
throw new IllegalArgumentException(new StringBuilder().append("columnValue:").append(columnValue).append(" Please check if the format satisfied.").toString(),e);
}
}
@Override
public Integer[] calculateRange(String beginValue, String endValue) {
try {
int startPartition, endPartition;
Calendar partitionTime = Calendar.getInstance();
SimpleDateFormat format = new SimpleDateFormat(dateFormat);
partitionTime.setTime(format.parse(beginValue));
startPartition = ((partitionTime.get(Calendar.YEAR) - beginDate.get(Calendar.YEAR))
* 12 + partitionTime.get(Calendar.MONTH)
- beginDate.get(Calendar.MONTH));
partitionTime.setTime(format.parse(endValue));
endPartition = ((partitionTime.get(Calendar.YEAR) - beginDate.get(Calendar.YEAR))
* 12 + partitionTime.get(Calendar.MONTH)
- beginDate.get(Calendar.MONTH));
View on GitHub (pinned to 65f8d8beb7)