dybyte commented on code in PR #9984:
URL: https://github.com/apache/seatunnel/pull/9984#discussion_r2486458436
##########
seatunnel-formats/seatunnel-format-text/src/main/java/org/apache/seatunnel/format/text/TextDeserializationSchema.java:
##########
@@ -330,6 +336,30 @@ private Object convert(
LocalTime localTime =
parsedTimestamp.query(TemporalQueries.localTime());
LocalDate localDate =
parsedTimestamp.query(TemporalQueries.localDate());
return LocalDateTime.of(localDate, localTime);
+ case TIMESTAMP_TZ:
+ DateTimeFormatter dateTimeTzFormatter =
fieldFormatterMap.get(fieldName);
+ if (dateTimeTzFormatter == null) {
+ dateTimeTzFormatter =
DateTimeUtils.matchDateTimeFormatter(field);
+ fieldFormatterMap.put(fieldName, dateTimeTzFormatter);
+ }
+ if (dateTimeTzFormatter == null) {
+ throw CommonError.formatDateTimeError(field, fieldName);
+ }
+
+ TemporalAccessor parsedTimestampTz =
dateTimeTzFormatter.parse(field);
+ LocalTime localTimeTz =
parsedTimestampTz.query(TemporalQueries.localTime());
+ LocalDate localDateTz =
parsedTimestampTz.query(TemporalQueries.localDate());
+ ZoneOffset offset =
parsedTimestampTz.query(TemporalQueries.offset());
+
+ if (offset == null) {
+ offset =
ZoneId.systemDefault().getRules().getOffset(Instant.now());
+ }
+
+ if (localDateTz == null || localTimeTz == null) {
+ throw CommonError.formatDateTimeError(field, fieldName);
+ }
+
+ return OffsetDateTime.of(localDateTz, localTimeTz, offset);
Review Comment:
Please add a test case for this change.
--
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]