zhangbutao commented on code in PR #3709:
URL: https://github.com/apache/hive/pull/3709#discussion_r1009065886


##########
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);
     }
   }
 
+  private Boolean checkParamMeta(PreparedStatement statement) throws 
SQLException {
+    String dbType = 
statement.getConnection().toString().split(":")[1].toUpperCase();

Review Comment:
   Yes, i agree this change is not very elegant. I have moved the code logic 
into `jdbcSerDe:initialize`. Please check again.



-- 
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]

Reply via email to