davidzollo commented on code in PR #10048:
URL: https://github.com/apache/seatunnel/pull/10048#discussion_r2518249590
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/psql/PostgresJdbcRowConverter.java:
##########
@@ -316,4 +362,110 @@ public String microsecondsToIntervalFormatVal(String
intervalVal) {
if (seconds > 0) sb.append(seconds).append(" seconds");
return sb.toString().trim();
}
+
+ private OffsetDateTime getPostgresOffsetDateTime(ResultSet rs, int
columnIndex)
+ throws SQLException {
+ // Read the value ONCE to avoid drivers returning null on subsequent
reads
+ final Object obj;
+ try {
+ obj = rs.getObject(columnIndex);
+ } catch (SQLException e) {
+ log.debug("Failed to get object from ResultSet at column {}",
columnIndex, e);
+ // Best-effort fallback to string, still only a single read path
for parsing
+ try {
+ final String str = rs.getString(columnIndex);
+ if (str != null && !str.trim().isEmpty()) {
+ return parsePostgresTimestampTz(str);
+ }
+ } catch (SQLException se) {
+ log.debug("Failed to get string from ResultSet at column {}",
columnIndex, se);
+ }
+ return null;
Review Comment:
`getPostgresOffsetDateTime`/`parsePostgresTimestampTz` 's fault-tolerant
strategy is "parse failed to return null", and only debug-level logging is
done. This means that once a timestamptz string is legal but not overwritten by
the current regex (e.g. with time-distinguished name, lowercase z, or other
equivalent formats returned by future drivers), SeaTunnel will silently write
the field as null.
This should throw SQLException when it cannot be parsed, so that the task
fails quickly with the "data unparsed" error, rather than silently swallowing it
--
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]