zhangbutao commented on code in PR #3709:
URL: https://github.com/apache/hive/pull/3709#discussion_r1009078141
##########
jdbc-handler/src/main/java/org/apache/hive/storage/jdbc/DBRecordWritable.java:
##########
@@ -61,16 +60,30 @@ public void write(PreparedStatement statement) throws
SQLException {
if (columnValues == null) {
throw new SQLException("No data available to be written");
}
- ParameterMetaData parameterMetaData = statement.getParameterMetaData();
for (int i = 0; i < columnValues.length; i++) {
Object value = columnValues[i];
- if ((parameterMetaData.getParameterType(i + 1) == Types.CHAR) && value
!= null && value instanceof Boolean) {
+ if ((checkParamMeta(statement) &&
statement.getParameterMetaData().getParameterType(i + 1) == Types.CHAR)
+ && value != null && value instanceof Boolean) {
value = ((Boolean) value).booleanValue() ? "1" : "0";
}
statement.setObject(i + 1, value);
Review Comment:
> can't we do the conversion earlier. E.g., when we setup columnValues?
I think not. type conversion depends on actual type which can only be
retrieved from underly jdbc-datasource using jdbc api `parameterMetaData`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]