Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MINOR][PYTHON][DOCS] Fix the type hint for extract, date_part and datepart #48613

Closed
wants to merge 2 commits into from

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