zhangshenghang commented on code in PR #10048:
URL: https://github.com/apache/seatunnel/pull/10048#discussion_r2538335530


##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/utils/JdbcFieldTypeUtils.java:
##########
@@ -95,12 +100,135 @@ public static byte[] getBytes(ResultSet resultSet, int 
columnIndex) throws SQLEx
         return resultSet.getBytes(columnIndex);
     }
 
+    public static OffsetDateTime getOffsetDateTime(ResultSet resultSet, int 
columnIndex)
+            throws SQLException {
+        final Object obj = resultSet.getObject(columnIndex);
+        if (obj == null) {
+            return null;
+        }
+
+        // Handle Oracle proprietary TIMESTAMP WITH TIME ZONE types
+        // oracle.sql.TIMESTAMPTZ - TIMESTAMP WITH TIME ZONE
+        // oracle.sql.TIMESTAMPLTZ - TIMESTAMP WITH LOCAL TIME ZONE
+        String className = obj.getClass().getName();
+        if ("oracle.sql.TIMESTAMPTZ".equals(className)
+                || "oracle.sql.TIMESTAMPLTZ".equals(className)) {
+            try {
+                // Use reflection to call toOffsetDateTime() or 
offsetDateTimeValue() method
+                // These methods are available in Oracle JDBC driver
+                java.lang.reflect.Method toOffsetDateTimeMethod = null;
+                try {
+                    // Try toOffsetDateTime() first (no connection required)
+                    toOffsetDateTimeMethod = 
obj.getClass().getMethod("toOffsetDateTime");
+                    return (OffsetDateTime) toOffsetDateTimeMethod.invoke(obj);

Review Comment:
   Using reflection methods every time is very slow in terms of performance. Is 
it necessary to use reflection here? Could you tell me why? If it's necessary, 
please optimize it through caching.



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

Reply via email to