{"record":{"id":"8d093db66a89e67d","repo":"alibaba/DataX","slug":"date-s","errorCode":null,"errorMessage":"Date 类型转换错误：[%s]","messagePattern":"Date 类型转换错误：\\[(.+?)\\]","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/insert/AdsInsertProxy.java","lineNumber":550,"sourceCode":"                Long longValue = column.asLong();\n                if (null == longValue) {\n                    statement.setNull(preparedPatamIndex + 1, Types.BIGINT);\n                } else {\n                    statement.setLong(preparedPatamIndex + 1, longValue);\n                }\n\n                break;\n\n            case Types.DATE:\n                java.sql.Date sqlDate = null;\n                try {\n                    if (\"\".equals(column.getRawData())) {\n                        utilDate = null;\n                    } else {\n                        utilDate = column.asDate();\n                    }\n                } catch (DataXException e) {\n                    throw new SQLException(String.format(\n                            \"Date 类型转换错误：[%s]\", column));\n                }\n\n                if (null != utilDate) {\n                    sqlDate = new java.sql.Date(utilDate.getTime());\n                }\n                statement.setDate(preparedPatamIndex + 1, sqlDate);\n                break;\n\n            case Types.TIME:\n                java.sql.Time sqlTime = null;\n                try {\n                    if (\"\".equals(column.getRawData())) {\n                        utilDate = null;\n                    } else {\n                        utilDate = column.asDate();\n                    }\n                } catch (DataXException e) {","sourceCodeStart":532,"sourceCodeEnd":568,"githubUrl":"https://github.com/alibaba/DataX/blob/80ec23d5c5328eb90ca364d2749e92dfaf44541e/adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/insert/AdsInsertProxy.java#L532-L568","documentation":"Raised in AdsInsertProxy while binding a DATE column in a prepared INSERT: if column.asDate() throws DataXException (the Column cannot be interpreted as a date), it is wrapped as SQLException 'Date 类型转换错误：[<column>]'. The bracketed part is the offending Column's toString, so it shows the raw value and type that failed.","triggerScenarios":"Filling a prepared statement for a target column of java.sql.Types.DATE where the incoming Column is e.g. a StringColumn whose content is not parseable as a date, or a numeric/bytes column coerced via asDate().","commonSituations":"Dirty source data ('2023-13-45', 'N/A', trailing spaces), a reader delivering dates as strings in a format the Column's asDate() cannot parse, or a column-order/type mismatch between the job config's column list and the ADS table schema.","solutions":["Copy the failing value from the exception message and test its format against the expected date format.","If the source column is a string, set the correct date format in the reader/writer column config or trim/clean the data so values are empty or valid dates.","Check that the job's column order matches the ADS table definition (a shifted column makes a non-date value land on the DATE column).","Add a transformer or dirty-data handling to route unparseable values to the side channel instead of failing the task."],"exampleFix":"# before: source row\n2023-13-45,alice\n# after (clean or route dirty rows)\n2023-04-15,alice","handlingStrategy":"try-catch","validationCode":"static final Pattern DATE_RE = Pattern.compile(\"\\\\d{4}-\\\\d{2}-\\\\d{2}\");\nboolean isParseableDate(Column c) {\n    String raw = c == null ? null : c.asString();\n    return raw == null || \"\".equals(raw) || DATE_RE.matcher(raw.trim()).matches();\n}","typeGuard":null,"tryCatchPattern":"try {\n    proxy.fillStatement(...);\n} catch (SQLException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Date 类型转换错误\")) {\n        // route row to dirty-data collector, keep task alive\n        dirtyCollector.collect(currentRecord, e.getMessage());\n        return;\n    }\n    throw e;\n}","preventionTips":["Standardize date strings to yyyy-MM-dd in the source or a transformer.","Check the configured column order against the ADS table schema before each run.","Enable DataX dirty-data handling (errorLimit) so single bad dates do not kill the whole job."],"tags":["adswriter","date","data-conversion","dirty-data"],"backgroundTag":null,"analyzedSha":"80ec23d5c5328eb90ca364d2749e92dfaf44541e","analyzedAt":"2026-08-14T15:33:51.187Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}