in adb3client/src/main/java/com/alibaba/cloud/analyticdb/adb3client/impl/UpsertStatementBuilder.java [447:470]
private void setTimeObject(PreparedStatement ps, int index, Object obj, int columnType) throws SQLException {
try {
if (obj instanceof String && (Types.TIMESTAMP_WITH_TIMEZONE == columnType || Types.TIMESTAMP == columnType)) {
ps.setTimestamp(index, Timestamp.valueOf((String) obj));
} else {
ps.setObject(index, obj, columnType);
}
} catch (SQLException e) {
if (ignoreTimeFormatError && e.getMessage() != null &&
e.getMessage().contains("Cannot convert class java.lang.String to SQL type requested")) {
LOGGER.debug("Time format error, index={}, columnType={}, obj={}", index, columnType, obj);
ps.setNull(index, columnType);
} else {
throw e;
}
} catch (IllegalArgumentException e) {
if (ignoreTimeFormatError) {
LOGGER.debug("Time format error, index={}, columnType={}, obj={}", index, columnType, obj);
ps.setNull(index, columnType);
} else {
throw e;
}
}
}