huan233usc commented on code in PR #746:
URL: https://github.com/apache/iceberg-cpp/pull/746#discussion_r3488580982


##########
src/iceberg/util/temporal_util.cc:
##########
@@ -444,6 +444,11 @@ Result<int64_t> 
TemporalUtils::ParseTimestampNsWithZone(std::string_view str) {
                               /*units_per_micro=*/internal::kNanosPerMicro);
 }
 
+Result<bool> TemporalUtils::IsUtcOffset(std::string_view str) {
+  ICEBERG_ASSIGN_OR_RAISE(auto timestamp_with_offset, 
ParseTimestampWithZoneSuffix(str));

Review Comment:
   It seems that Java reference accepts `Z`, `+00:00` and `-00:00` too. 
`SingleValueParser` gates timestamptz defaults on 
`DateTimeUtil.isUTCTimestamptz`, which is:
   
   ```java
   OffsetDateTime offsetDateTime = OffsetDateTime.parse(s, 
DateTimeFormatter.ISO_DATE_TIME);
   return offsetDateTime.getOffset().equals(ZoneOffset.UTC);
   ```
   
   i.e. it checks the parsed offset equals UTC (zero), so `Z`/`+00:00`/`-00:00` 
all pass and only a non-zero offset is rejected — exactly what `IsUtcOffset` 
does here. (Java's error string says "offset must be +00:00", but the actual 
check is offset == UTC.)
   
   Ref: 
https://github.com/apache/iceberg/blob/main/api/src/main/java/org/apache/iceberg/util/DateTimeUtil.java



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to