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:
每次都通过反射方法性能很慢,这里必须用反射吗,能说下为什么吗?如果必须用请通过缓存来优化它
--
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]