-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-36660][SQL] Add cot as Scala and Python functions #33906
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
Conversation
|
cc @wangyum |
|
cc @HyukjinKwon |
| * @group math_funcs | ||
| * @since 3.2.0 | ||
| */ | ||
| def cot(e: Column): Column = withExpr { Cot(e.expr) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's only add this one (Column only).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review. I saw other trig functions accept both Column and String(columnName). Should we not use columnName for the parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, read the guides on the top of f functions.scala
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, thank you I just removed it.
|
ok to test |
|
I am okay with this. |
|
Kubernetes integration test starting |
Co-authored-by: Hyukjin Kwon <[email protected]>
|
BTW noticed that cosecant and secant are missing. Though they are just the reciprocals of sin and cos, I feel a bit odd that only cot is supported. |
|
Kubernetes integration test status failure |
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
The arguments here are the same as for SPARK-33061 (#29938). so if we've added those, this one should be fine as well. |
|
Test build #142969 has finished for PR 33906 at commit
|
|
Test build #142972 has finished for PR 33906 at commit
|
| * @group math_funcs | ||
| * @since 3.2.0 | ||
| */ | ||
| def cot(columnName: String): Column = cot(Column(columnName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind removing this one? Looks fine otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reminder. I just removed it.
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #143006 has finished for PR 33906 at commit
|
|
Merged to master. |
|
I mentioned before but how about implementing SEC/CSC? I believe they can be used as much as COT. |
|
I am fine with them. |
| return _invoke_function_over_column("cosh", col) | ||
|
|
||
|
|
||
| def cot(col): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually you should also add them in functions.R too. ref: aeb45df
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I forgot about that. I'm pushing the follow-up PR soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is fine. usually SparkR one is done separately in a separate JIRA.
|
Thank you. I'll post the new ticket and start working on them. |
### What changes were proposed in this pull request? Add cotangent as an R function. ### Why are the changes needed? My previous PR (#33906) missed R support. ### Does this PR introduce _any_ user-facing change? Yes, users can now call the cotangent function as an R function. ### How was this patch tested? unit tests. Closes #33925 from yutoacts/SPARK-36660. Lead-authored-by: Yuto Akutsu <[email protected]> Co-authored-by: Yuto Akutsu <[email protected]> Signed-off-by: Hyukjin Kwon <[email protected]>
|
We need to change |
|
Yup |
|
Thank you, I just added to it. |
### What changes were proposed in this pull request? Added cot to pyspark.sql.rst (follow-up) ### Why are the changes needed? [My previous PR](#33906) was missing it. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? manual check Closes #34002 from yutoacts/SPARK-36660. Authored-by: Yuto Akutsu <[email protected]> Signed-off-by: Hyukjin Kwon <[email protected]>
### What changes were proposed in this pull request? Add new built-in SQL functions: secant and cosecant, and add them as Scala and Python functions. ### Why are the changes needed? Cotangent has been supported in Spark SQL but Secant and Cosecant are missing though I believe they can be used as much as cot. Related Links: [SPARK-20751](#17999) [SPARK-36660](#33906) ### Does this PR introduce _any_ user-facing change? Yes, users can now use these functions. ### How was this patch tested? Unit tests Closes #33988 from yutoacts/SPARK-36683. Authored-by: Yuto Akutsu <[email protected]> Signed-off-by: Kousuke Saruta <[email protected]>
### What changes were proposed in this pull request? Add new built-in SQL functions: secant and cosecant, and add them as Scala and Python functions. ### Why are the changes needed? Cotangent has been supported in Spark SQL but Secant and Cosecant are missing though I believe they can be used as much as cot. Related Links: [SPARK-20751](apache/spark#17999) [SPARK-36660](apache/spark#33906) ### Does this PR introduce _any_ user-facing change? Yes, users can now use these functions. ### How was this patch tested? Unit tests Closes #33988 from yutoacts/SPARK-36683. Authored-by: Yuto Akutsu <[email protected]> Signed-off-by: Kousuke Saruta <[email protected]>
What changes were proposed in this pull request?
Add cotangent support by Dataframe operations (e.g.
df.select(cot($"col"))).Why are the changes needed?
Cotangent has been supported by Spark SQL since 2.3.0 but it cannot be called by Dataframe operations.
Does this PR introduce any user-facing change?
Yes, users can now call the cotangent function by Dataframe operations.
How was this patch tested?
manual test.