zhangbutao commented on code in PR #3709:
URL: https://github.com/apache/hive/pull/3709#discussion_r1009068518
##########
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:
I have created `DerbyRecordWritable`which extends `DBRecordWritable`for
derby, and other jdbc datasources(eg. mysql, pg) can use original
`DBRecordWritable` which does not rely on parameterMetaData . Please check
again. Thank you.
--
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]