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

[SPARK-43929][SQL][PYTHON][CONNECT] Add date time functions to Scala, Python and Connect API - part 1 #41636

Closed
wants to merge 3 commits into from

Conversation

beliefer
Copy link
Contributor

What changes were proposed in this pull request?

This PR want add date time functions to Scala, Python and Connect API. These functions show below.

  • dateadd
  • date_diff
  • date_from_unix_date
  • day

The origin plan also contains the two function date_part and datepart. You can see this PR exclude them, since we can't get the data type for unresolved expressions. Please refer

object DatePartExpressionBuilder extends ExpressionBuilder {
and
def createExpr(funcName: String, field: Expression, source: Expression): Expression = {

Why are the changes needed?

Add date time functions to Scala, Python and Connect API.

Does this PR introduce any user-facing change?

'No'.
New feature.

How was this patch tested?

New test cases.

@beliefer
Copy link
Contributor Author

ping @zhengruifeng cc @HyukjinKwon

@zhengruifeng
Copy link
Contributor

@beliefer please re-trigger the failed test

@zhengruifeng
Copy link
Contributor

thanks, merged to master

@beliefer
Copy link
Contributor Author

@zhengruifeng Thank you!

@zhengruifeng
Copy link
Contributor

@beliefer I guess we can support date_part and datepart via call_udf (see #41659), please help checking it and send a follow up if possible, thanks!

czxm pushed a commit to czxm/spark that referenced this pull request Jun 19, 2023
… Python and Connect API - part 1

### What changes were proposed in this pull request?
This PR want add date time functions to Scala, Python and Connect API. These functions show below.

- dateadd
- date_diff
- date_from_unix_date
- day

The origin plan also contains the two function `date_part` and `datepart`. You can see this PR exclude them, since we can't get the data type for unresolved expressions. Please refer https://github.com/apache/spark/blob/b97ce8b9a99c570fc57dec967e7e9db3d115c1db/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala#L2835 and https://github.com/apache/spark/blob/b97ce8b9a99c570fc57dec967e7e9db3d115c1db/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala#L2922

### Why are the changes needed?
Add date time functions to Scala, Python and Connect API.

### Does this PR introduce _any_ user-facing change?
'No'.
New feature.

### How was this patch tested?
New test cases.

Closes apache#41636 from beliefer/SPARK-43929.

Authored-by: Jiaan Geng <beliefer@163.com>
Signed-off-by: Ruifeng Zheng <ruifengz@apache.org>
@beliefer
Copy link
Contributor Author

@beliefer I guess we can support date_part and datepart via call_udf (see #41659), please help checking it and send a follow up if possible, thanks!

I see.

zhengruifeng pushed a commit that referenced this pull request Jun 20, 2023
…t, date_part, datepart to Scala, Python and Connect API

### What changes were proposed in this pull request?
This PR follows up #41636 and #41651 and add extract, date_part, datepart to Scala, Python and Connect API.

### Why are the changes needed?
Add extract, date_part, datepart to Scala, Python and Connect API

### Does this PR introduce _any_ user-facing change?
'No'.
New feature.

### How was this patch tested?
New test cases.

Closes #41667 from beliefer/datetime_functions_followup.

Authored-by: Jiaan Geng <beliefer@163.com>
Signed-off-by: Ruifeng Zheng <ruifengz@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants