alibaba/DataX · error · SQLException
TIME 类型转换错误:[%s]
Error message
TIME 类型转换错误:[%s]
What it means
Same binding path as the DATE case, but for a target column of java.sql.Types.TIME in AdsInsertProxy: when column.asDate() throws DataXException the value cannot be converted to a time, and it is rethrown as SQLException 'TIME 类型转换错误:[<column>]' with the offending Column in brackets.
Source
Thrown at adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/insert/AdsInsertProxy.java:569
"Date 类型转换错误:[%s]", column));
}
if (null != utilDate) {
sqlDate = new java.sql.Date(utilDate.getTime());
}
statement.setDate(preparedPatamIndex + 1, sqlDate);
break;
case Types.TIME:
java.sql.Time sqlTime = null;
try {
if ("".equals(column.getRawData())) {
utilDate = null;
} else {
utilDate = column.asDate();
}
} catch (DataXException e) {
throw new SQLException(String.format(
"TIME 类型转换错误:[%s]", column));
}
if (null != utilDate) {
sqlTime = new java.sql.Time(utilDate.getTime());
}
statement.setTime(preparedPatamIndex + 1, sqlTime);
break;
case Types.TIMESTAMP:
java.sql.Timestamp sqlTimestamp = null;
try {
if ("".equals(column.getRawData())) {
utilDate = null;
} else {
utilDate = column.asDate();
}
} catch (DataXException e) {View on GitHub (pinned to 80ec23d5c5)
Solutions
- Inspect the bracketed value in the message and confirm it is a parseable time literal.
- Normalize time strings upstream (e.g. to HH:mm:ss) or convert the column to a string/varchar target instead.
- Verify the job column list order matches the ADS table's TIME column position.
- Enable dirty-data collection so unparseable times are recorded instead of aborting the write.
Example fix
# before 3 o'clock PM # after 15:00:00
Defensive patterns
Strategy: try-catch
Validate before calling
static final Pattern TIME_RE = Pattern.compile("\\d{2}:\\d{2}:\\d{2}(.\\d+)?");
boolean isParseableTime(Column c) {
String raw = c == null ? null : c.asString();
return raw == null || "".equals(raw) || TIME_RE.matcher(raw.trim()).matches();
} Try / catch
try {
proxy.fillStatement(...);
} catch (SQLException e) {
if (e.getMessage() != null && e.getMessage().contains("TIME 类型转换错误")) {
dirtyCollector.collect(currentRecord, e.getMessage());
return;
}
throw e;
} Prevention
- Normalize times to HH:mm:ss (24h) upstream; strip AM/PM and timezone decorations.
- Validate time-format columns with a sample-run before full loads.
- Align the job's column list order with the ADS table definition.
When it happens
Trigger: Binding a TIME column from a Column that asDate() cannot parse - e.g. a string like '25:99:00', a locale-formatted time ('下午3点'), or a completely different type landed on this index due to column misalignment.
Common situations: Source systems exporting times in non-ISO formats (AM/PM, with timezone suffix), CSV readers with no format hint, or column-order drift between the configured column list and the ADS table.
Related errors
AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14).
Data as JSON: /api/errors/4fcd0cec4332ed1c.
Report an issue: GitHub.