in src/main/java/com/aliyun/odps/jdbc/utils/transformer/to/jdbc/ToJdbcStringTransformer.java [44:70]
public Object transform(
Object o,
String charset,
Calendar cal,
TimeZone timeZone,
TypeInfo odpsType) throws SQLException {
if (o == null) {
return null;
}
if (o instanceof byte[]) {
return encodeBytes((byte[]) o, charset);
}
OdpsRecordConverter odpsRecordConverter = RecordConverterCache.get(timeZone);
try {
// odps record converter always use utf-8 encoding.
if (charset != null && !charset.equals(StandardCharsets.UTF_8.name())) {
return new java.lang.String(
(odpsRecordConverter.formatObject(o, odpsType).getBytes(StandardCharsets.UTF_8)),
charset);
}
return odpsRecordConverter.formatObject(o, odpsType);
} catch (Exception e) {
String errorMsg = getTransformationErrMsg(Objects.toString(o), byte[].class, e.getMessage());
throw new SQLException(errorMsg, e);
}
}