{"record":{"id":"113ecf0421ad46e9","repo":"alibaba/DataX","slug":"timestamp-s","errorCode":null,"errorMessage":"TIMESTAMP 类型转换错误：[%s]","messagePattern":"TIMESTAMP 类型转换错误：\\[(.+?)\\]","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/insert/AdsInsertProxy.java","lineNumber":588,"sourceCode":"                            \"TIME 类型转换错误：[%s]\", column));\n                }\n\n                if (null != utilDate) {\n                    sqlTime = new java.sql.Time(utilDate.getTime());\n                }\n                statement.setTime(preparedPatamIndex + 1, sqlTime);\n                break;\n\n            case Types.TIMESTAMP:\n                java.sql.Timestamp sqlTimestamp = 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                            \"TIMESTAMP 类型转换错误：[%s]\", column));\n                }\n\n                if (null != utilDate) {\n                    sqlTimestamp = new java.sql.Timestamp(\n                            utilDate.getTime());\n                }\n                statement.setTimestamp(preparedPatamIndex + 1, sqlTimestamp);\n                break;\n\n            case Types.BOOLEAN:\n                //case Types.BIT: ads 没有bit\n                Boolean booleanValue = column.asBoolean();\n                if (null == booleanValue) {\n                    statement.setNull(preparedPatamIndex + 1, Types.BOOLEAN);\n                } else {\n                    statement.setBoolean(preparedPatamIndex + 1, booleanValue);\n                }","sourceCodeStart":570,"sourceCodeEnd":606,"githubUrl":"https://github.com/alibaba/DataX/blob/80ec23d5c5328eb90ca364d2749e92dfaf44541e/adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/insert/AdsInsertProxy.java#L570-L606","documentation":"The TIMESTAMP variant of the same guard in AdsInsertProxy: binding a java.sql.Types.TIMESTAMP parameter, column.asDate() threw DataXException, so the row's value is not interpretable as a timestamp and the proxy raises SQLException 'TIMESTAMP 类型转换错误：[<column>]' including the failing Column.","triggerScenarios":"A target TIMESTAMP column receives a Column whose asDate() fails - typical with string values like '2023-04-15T10:00:00Z[UTC]' variants the parser rejects, epoch numbers passed as LongColumn in an unexpected unit, or null-adjacent garbage ('null', '--').","commonSituations":"Mixed-format timestamp exports, timezone-decorated strings, Excel/CSV artifacts ('45123' serial dates), or column misalignment after schema changes on the ADS table.","solutions":["Take the exact value from the exception text and validate it against the expected timestamp format.","Standardize timestamps upstream to 'yyyy-MM-dd HH:mm:ss' (or configure the reader's format) before the write.","Re-check column order/types between job config and the ADS table after any schema change.","Route repeated offenders to dirty-data handling or convert the target column to VARCHAR if fidelity matters more than type."],"exampleFix":"# before\n15/04/2023 10.00.00\n# after\n2023-04-15 10:00:00","handlingStrategy":"try-catch","validationCode":"static final Pattern TS_RE = Pattern.compile(\"\\\\d{4}-\\\\d{2}-\\\\d{2}[ T]\\\\d{2}:\\\\d{2}:\\\\d{2}(.\\\\d+)?\");\nboolean isParseableTimestamp(Column c) {\n    String raw = c == null ? null : c.asString();\n    return raw == null || \"\".equals(raw) || TS_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(\"TIMESTAMP 类型转换错误\")) {\n        dirtyCollector.collect(currentRecord, e.getMessage());\n        return;\n    }\n    throw e;\n}","preventionTips":["Emit timestamps as yyyy-MM-dd HH:mm:ss from sources; avoid Excel serial dates and locale formats.","Test asDate() parsing on a sample of real rows before the production run.","Use a transformer to fix known-bad timestamp patterns instead of letting the writer fail."],"tags":["adswriter","timestamp","data-conversion","dirty-data"],"backgroundTag":null,"analyzedSha":"80ec23d5c5328eb90ca364d2749e92dfaf44541e","analyzedAt":"2026-08-14T15:33:51.187Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}