walterddr commented on a change in pull request #8248: [FLINK-12309][JDBC] 
JDBCOoutputFormat and JDBCAppendTableSink float behavior is not align
URL: https://github.com/apache/flink/pull/8248#discussion_r279415433
 
 

 ##########
 File path: 
flink-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCOutputFormat.java
 ##########
 @@ -160,7 +160,11 @@ public void writeRecord(Row row) throws IOException {
                                                                        break;
                                                                case 
java.sql.Types.FLOAT:
                                                                case 
java.sql.Types.DOUBLE:
-                                                                       
upload.setDouble(index + 1, (double) row.getField(index));
+                                                                       if 
(row.getField(index).getClass() == Float.class) {
 
 Review comment:
   I am not sure this is the right approach. shouldn't we do something like:
   ```
   case java.sql.Types.FLOAT:
     upload.setFloat(index + 1, (float) row.getField(index));
     break;
   case java.sql.Types.DOUBLE:
     upload.setDouble(index + 1, (double) row.getField(index));
     break;
   ```
   that would make more sense to me since the row is float, the type mapping is 
also float. 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to