carloea2 commented on code in PR #8704:
URL: https://github.com/apache/texera/pull/8704#discussion_r4362913069


##########
amber/src/main/python/core/models/schema/attribute_type.py:
##########
@@ -98,18 +98,18 @@ def _parse_bool(v):
 
 
 def _parse_timestamp(v):
+    # A TIMESTAMP reaches a worker as a wall clock with no zone, so a value
+    # parsed here holds none either and compares with a row's. An offset is
+    # moved to the machine's zone first, as the engine's DateParserUtils does.
     if _is_empty_value(v):
-        return datetime.datetime(1970, 1, 1, tzinfo=datetime.timezone.utc)
+        return datetime.datetime(1970, 1, 1)
 
     normalized_value = str(v)
     if normalized_value.endswith("Z"):
         normalized_value = normalized_value[:-1] + "+00:00"
     parsed_value = datetime.datetime.fromisoformat(normalized_value)
-    if (
-        parsed_value.tzinfo is None
-        or parsed_value.tzinfo.utcoffset(parsed_value) is None
-    ):
-        return parsed_value.replace(tzinfo=datetime.timezone.utc)
+    if parsed_value.utcoffset() is not None:
+        return parsed_value.astimezone().replace(tzinfo=None)
     return parsed_value
 

Review Comment:
   On Windows, astimezone without an explicit zone uses localtime, which 
refuses these pre-1970 instants. Through FROM_STRING_PARSER_MAPPING[TIMESTAMP], 
1960-01-01T12:00:00Z, 1960-01-01T12:00:00+02:00 and 1600-01-01T12:00:00Z now 
raise OSError 22. All three were accepted before this change. A 1600 value 
without an offset and 2024 and 3000 offset values still work. Please preserve 
the intended local wall clock without relying on the Windows localtime range.



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