Skip to content

Conversation

zhengruifeng
Copy link
Contributor

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:

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

@zhengruifeng
Copy link
Contributor Author

merged to master

@zhengruifeng zhengruifeng deleted the fix_extract_hint branch October 23, 2024 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants