{"record":{"id":"bb03c4d17a35ebca","repo":"alibaba/DataX","slug":"date-s-yyyy-mm-dd","errorCode":null,"errorMessage":"DATE类型数据 '%s' 格式不正确，必须为yyyy-mm-dd格式","messagePattern":"DATE类型数据 '(.+?)' 格式不正确，必须为yyyy-mm-dd格式","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"cassandrawriter/src/main/java/com/alibaba/datax/plugin/writer/cassandrawriter/CassandraWriterHelper.java","lineNumber":102,"sourceCode":"    case BIGINT:\n      return Long.valueOf(s);\n\n    case VARINT:\n      return new BigInteger(s, 10);\n\n    case FLOAT:\n      return Float.valueOf(s);\n\n    case DOUBLE:\n      return Double.valueOf(s);\n\n    case DECIMAL:\n      return new BigDecimal(s);\n\n    case DATE: {\n      String[] a = s.split(\"-\");\n      if (a.length != 3) {\n        throw new Exception(String.format(\"DATE类型数据 '%s' 格式不正确，必须为yyyy-mm-dd格式\", s));\n      }\n      return LocalDate.fromYearMonthDay(Integer.valueOf(a[0]), Integer.valueOf(a[1]),\n          Integer.valueOf(a[2]));\n    }\n\n    case TIME:\n      return Long.valueOf(s);\n\n    case TIMESTAMP:\n      return new Date(Long.valueOf(s));\n\n    case UUID:\n    case TIMEUUID:\n      return UUID.fromString(s);\n\n    case INET:\n      String[] b = s.split(\"/\");\n      if (b.length < 2) {","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/alibaba/DataX/blob/80ec23d5c5328eb90ca364d2749e92dfaf44541e/cassandrawriter/src/main/java/com/alibaba/datax/plugin/writer/cassandrawriter/CassandraWriterHelper.java#L84-L120","documentation":"Thrown by CassandraWriterHelper's string-to-value converter for DATE columns. It expects a strict yyyy-mm-dd literal (exactly two '-' separators after split), and anything else — '2024/01/02', '2024-1-2', empty fragments, or a full timestamp — fails the a.length != 3 check. The message names the offending value and the required format.","triggerScenarios":"A cassandrawriter column of CQL type DATE whose incoming string does not split on '-' into exactly 3 parts, e.g. '2024/12/01', '2024-12-01 00:00:00', or '2024-12'.","commonSituations":"Reader emitting timestamps or localized date strings into a DATE column; column configuration declaring a DATE type for data that is actually a timestamp; hand-written test data with mixed separators or missing zero-padding is fine ('2024-1-2' still splits to 3) but any format with != 3 dash-separated parts throws.","solutions":["Normalize the source value to yyyy-mm-dd before it reaches cassandrawriter (convert in the reader or via a transform)","If the data is really a timestamp, change the Cassandra column/writer type mapping to TIMESTAMP instead of DATE","Fix malformed rows in the source data (wrong separators, missing parts)"],"exampleFix":"// before\n{\"name\": \"cassandrawriter\", \"parameter\": {\"column\": [{\"name\": \"d\", \"type\": \"DATE\"}]}}\n// source value: \"2024/12/01\" -> throws\n// after: convert source to \"2024-12-01\" (yyyy-mm-dd) or declare the column as TIMESTAMP","handlingStrategy":"validation","validationCode":"// normalize before writing DATE columns\nstatic String toIsoDate(String s) {\n    String[] a = s.split(\"-\");\n    if (a.length != 3) throw new IllegalArgumentException(\"Not yyyy-mm-dd: \" + s);\n    return String.format(\"%04d-%02d-%02d\", Integer.valueOf(a[0].trim()), Integer.valueOf(a[1].trim()), Integer.valueOf(a[2].trim()));\n}","typeGuard":"boolean isYyyyMmDd(String s) {\n    return s != null && s.split(\"-\").length == 3\n        && s.matches(\"\\\\d{1,4}-\\\\d{1,2}-\\\\d{1,2}\");\n}","tryCatchPattern":"catch (Exception e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"yyyy-mm-dd\")) {\n    // route the row to a dirty-data sink or fix the source format\n  }\n  throw e;\n}","preventionTips":["Emit dates from the reader as Date objects or ISO yyyy-mm-dd strings","Use TIMESTAMP mapping when source values carry time components","Profile source date formats before configuring Cassandra DATE columns"],"tags":["cassandrawriter","date-format","type-conversion","data-quality"],"backgroundTag":null,"analyzedSha":"80ec23d5c5328eb90ca364d2749e92dfaf44541e","analyzedAt":"2026-08-14T15:33:51.187Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}