Skip to content

Commit

Permalink
[SPARK-47202][PYTHON] Fix typo breaking datetimes with tzinfo
Browse files Browse the repository at this point in the history
This PR fixes a bug caused due to a typo.

This bug is preventing users from having datetime.datetime objects with tzinfo when using the `TimestampType`

No, just a bug fix.

There ought to be CI that lints code and catches these simple errors at the time of opening the PR.

No

Closes #45301 from arzavj/SPARK-47202.

Authored-by: Arzav Jain <arzavj@users.noreply.github.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
(cherry picked from commit bf8396e)
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
  • Loading branch information
arzavj authored and HyukjinKwon committed Feb 28, 2024
1 parent 96688ac commit c0a4416
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/pyspark/sql/pandas/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ def convert_timestamp(value: Any) -> Any:
return None
else:
if isinstance(value, datetime.datetime) and value.tzinfo is not None:
ts = pd.Timstamp(value)
ts = pd.Timestamp(value)
else:
ts = pd.Timestamp(value).tz_localize(timezone)
return ts.to_pydatetime()
Expand Down

0 comments on commit c0a4416

Please sign in to comment.