deepyaman commented on a change in pull request #27295: Fix src/dest type
documentation for `to_timestamp`
URL: https://github.com/apache/spark/pull/27295#discussion_r368706522
##########
File path: python/pyspark/sql/functions.py
##########
@@ -1161,7 +1161,7 @@ def to_date(col, format=None):
@since(2.2)
def to_timestamp(col, format=None):
"""Converts a :class:`Column` of :class:`pyspark.sql.types.StringType` or
- :class:`pyspark.sql.types.TimestampType` into
:class:`pyspark.sql.types.DateType`
+ :class:`pyspark.sql.types.DateType` into
:class:`pyspark.sql.types.TimestampType`
Review comment:
Hi @MaxGekk! Yes, it can. The other alternative is:
```python3
def to_timestamp(col, format=None):
"""Converts a :class:`Column` of :class:`pyspark.sql.types.StringType`,
:class:`pyspark.sql.types.DateType`, or
:class:`pyspark.sql.types.TimeStampType` into
:class:`pyspark.sql.types.TimestampType`
```
In that case, the documentation for `to_date` should also be updated to
explicitly say that it converts ```:class:`pyspark.sql.types.DateType` into
:class:`pyspark.sql.types.DateType` ```.
I chose to leave these two cases out because
1. that's how `to_date` does it
2. they're "trivial" cases
Happy to update both as above if you prefer, though.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]