zhengruifeng opened a new pull request, #48613:
URL: https://github.com/apache/spark/pull/48613

   ### What changes were proposed in this pull request?
   Fix the type hint for `extract`, `date_part` and `datepart`
   
   
   ### Why are the changes needed?
   argument `field` never supports column name:
   
   ```python
   In [6]: df = spark.createDataFrame([(datetime.datetime(2015, 4, 8, 13, 8, 
15), "YEAR",)], ['ts', 'field'])
   
   In [7]: df.select(sf.extract("field", "ts"))
   
   ...
   
   
   AnalysisException: [NON_FOLDABLE_ARGUMENT] The function `extract` requires 
the parameter `field` to be a foldable expression of the type "STRING", but the 
actual argument is a non-foldable. SQLSTATE: 42K08
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   yes, doc only change
   
   
   ### How was this patch tested?
   ci
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   no


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