mh0w opened a new issue, #56672:
URL: https://github.com/apache/spark/issues/56672

   ## The issue
   
   `pyspark.sql.functions.try_to_date` does not appear to exist in PySpark 
4.0.*.
   
   I cannot import or access it from `pyspark.sql.functions`, and I also cannot 
see it in the Spark 4.0 branch source:
   
https://github.com/apache/spark/blob/branch-4.0/python/pyspark/sql/functions/builtin.py
   
   By contrast, `pyspark.sql.functions.try_to_date` does appear to exist in 
PySpark 4.1.*:
   
https://github.com/apache/spark/blob/branch-4.1/python/pyspark/sql/functions/builtin.py#L11475
   
https://github.com/apache/spark/blob/fb14e6cee794191b8a27f3acc51e695492edeaa6/python/pyspark/sql/functions/builtin.py#L11475
   
   The current docs say that `pyspark.sql.functions.try_to_date` is:
   
   > New in version 4.0.0
   
   
https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.try_to_date.html
   
   That appears misleading.
   
   Presumably this is either:
   
   1. correct documentation, but a missing export / packaging issue in 
4.0.0-4.0.4, or
   2. incorrect documentation, and `try_to_date` was actually introduced in 
4.1.x
   
   ## Reproduction
   
   In an environment with PySpark 4.0.1, 4.0.2, 4.0.3, or 4.0.4 installed:
   
   ```python
   import pyspark
   from pyspark.sql import functions as F
   
   print(pyspark.__version__)
   print(hasattr(F, "try_to_date"))
   print(hasattr(F, "try_to_timestamp"))
   ```
   
   Output:
   ```
   4.0.4
   False
   True
   ```
   
   Trying to use `F.try_to_date(...)` fails with:
   > AttributeError: module 'pyspark.sql.functions' has no attribute 
'try_to_date'
   
   
   Expected behavior
   
   I think that one of the following should be true:
   1. if try_to_date is intended to be available in 4.0.*, it should be present 
in pyspark.sql.functions in those releases
   2. if it was only introduced in 4.1.*, the documentation should say that 
instead of claiming 'New in version 4.0.0'


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