kenny75557 commented on code in PR #59359:
URL: https://github.com/apache/spark/pull/59359#discussion_r4246704342
##########
python/pyspark/sql/tests/test_functions.py:
##########
@@ -694,8 +700,9 @@ def test_try_make_timestamp(self):
F.try_make_timestamp(timezone=df_dt.timezone)
def test_try_make_timestamp_ltz(self):
- # use local timezone here to avoid flakiness
- data = [(2024, 5, 22, 10, 30, 0,
datetime.datetime.now().astimezone().tzinfo.__str__())]
+ # Use an unambiguous zone ID: tz abbreviations such as CST or PDT are
misread or
+ # rejected by Spark.
+ data = [(2024, 5, 22, 10, 30, 0, "UTC")]
Review Comment:
Thanks! You're right. Using UTC does change what the test covers. The
original intent of passing the local timezone was to keep the expected value
environment-independent; the actual bug is that str(tzinfo) yields an
abbreviation (e.g. CST, PDT) that Spark misreads as America/Chicago or rejects.
I've update the test to pass the UTC offset on the test date instead, so it
keeps the original local-timezone scenario and expected value.
--
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]