YasuoStudyJava commented on code in PR #17676:
URL: https://github.com/apache/flink/pull/17676#discussion_r1316599115


##########
flink-connectors/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/internal/converter/OracleRowConverter.java:
##########
@@ -123,21 +121,33 @@ public JdbcDeserializationConverter 
createInternalConverter(LogicalType type) {
             case VARBINARY:
             case RAW:
                 return val ->
-                        (val instanceof RAW) ? ((RAW) val).getBytes() : val;
+                        val instanceof RAW
+                                ? ((RAW) val).getBytes()
+                                : val instanceof OracleBlob
+                                        ? ((OracleBlob) val)
+                                                .getBytes(1, (int) 
((OracleBlob) val).length())
+                                        : val.toString().getBytes();
+
             case INTERVAL_YEAR_MONTH:
             case INTERVAL_DAY_TIME:
                 return val -> val instanceof NUMBER ? ((NUMBER) 
val).intValue() : val;
             case DATE:
                 return val ->
                         val instanceof DATE
-                                ? ((DATE) 
val).dateValue().toLocalDate().toEpochDay()
-                                : (int) (((Date) 
val).toLocalDate().toEpochDay());
+                                ? (int) (((DATE) 
val).dateValue().toLocalDate().toEpochDay())
+                                : val instanceof Timestamp

Review Comment:
   I'm a bit confused here why it determines multiple types such as date and 
timestamp, because during actual testing and validation, I found that the date 
type data read from Oracle is always of timestamp type, so it's better to only 
keep the processing of timestamp type?
   `` 
   Or can you explain when the date type data read from Oracle is date instead 
of timestamp?



##########
flink-connectors/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/internal/converter/OracleRowConverter.java:
##########
@@ -123,21 +121,33 @@ public JdbcDeserializationConverter 
createInternalConverter(LogicalType type) {
             case VARBINARY:
             case RAW:
                 return val ->
-                        (val instanceof RAW) ? ((RAW) val).getBytes() : val;
+                        val instanceof RAW
+                                ? ((RAW) val).getBytes()
+                                : val instanceof OracleBlob
+                                        ? ((OracleBlob) val)
+                                                .getBytes(1, (int) 
((OracleBlob) val).length())
+                                        : val.toString().getBytes();
+
             case INTERVAL_YEAR_MONTH:
             case INTERVAL_DAY_TIME:
                 return val -> val instanceof NUMBER ? ((NUMBER) 
val).intValue() : val;
             case DATE:
                 return val ->
                         val instanceof DATE
-                                ? ((DATE) 
val).dateValue().toLocalDate().toEpochDay()
-                                : (int) (((Date) 
val).toLocalDate().toEpochDay());
+                                ? (int) (((DATE) 
val).dateValue().toLocalDate().toEpochDay())
+                                : val instanceof Timestamp

Review Comment:
   I'm a bit confused here why it determines multiple types such as date and 
timestamp, because during actual testing and validation, I found that the date 
type data read from Oracle is always of timestamp type, so it's better to only 
keep the processing of timestamp type?
   `` 
   Or can you explain when the date type data read from Oracle is date instead 
of timestamp?



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to