Uh oh!
There was an error while loading. Please reload this page.
[SPARK-36660][SQL] Add cot as Scala and Python functions - #33906
[SPARK-36660][SQL] Add cot as Scala and Python functions#33906yutoacts wants to merge 4 commits into
Conversation
yutoacts
commented
Sep 3, 2021
cc @wangyum |
wangyum
commented
Sep 3, 2021
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.
Let's only add this one (Column only).
There was a problem hiding this comment.
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.
Yeah, read the guides on the top of f functions.scala
There was a problem hiding this comment.
oh, thank you I just removed it.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
HyukjinKwon
commented
Sep 3, 2021
ok to test |
HyukjinKwon
commented
Sep 3, 2021
I am okay with this. |
SparkQA
commented
Sep 3, 2021
Kubernetes integration test starting |
Co-authored-by: Hyukjin Kwon <gurwls223@gmail.com>
yutoacts
commented
Sep 3, 2021
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. |
SparkQA
commented
Sep 3, 2021
Kubernetes integration test status failure |
SparkQA
commented
Sep 3, 2021
Kubernetes integration test starting |
SparkQA
commented
Sep 3, 2021
Kubernetes integration test status failure |
zero323
commented
Sep 3, 2021
The arguments here are the same as for SPARK-33061 (#29938). so if we've added those, this one should be fine as well. |
SparkQA
commented
Sep 3, 2021
Test build #142969 has finished for PR 33906 at commit
|
SparkQA
commented
Sep 3, 2021
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.
Mind removing this one? Looks fine otherwise
There was a problem hiding this comment.
Thanks for the reminder. I just removed it.
SparkQA
commented
Sep 6, 2021
Kubernetes integration test starting |
SparkQA
commented
Sep 6, 2021
Kubernetes integration test status failure |
SparkQA
commented
Sep 6, 2021
Test build #143006 has finished for PR 33906 at commit
|
HyukjinKwon
commented
Sep 6, 2021
Merged to master. |
yutoacts
commented
Sep 7, 2021
I mentioned before but how about implementing SEC/CSC? I believe they can be used as much as COT. |
HyukjinKwon
commented
Sep 7, 2021
I am fine with them. |
| return _invoke_function_over_column("cosh", col) | ||
| def cot(col): |
There was a problem hiding this comment.
actually you should also add them in functions.R too. ref: aeb45df
There was a problem hiding this comment.
Sorry, I forgot about that. I'm pushing the follow-up PR soon.
There was a problem hiding this comment.
this is fine. usually SparkR one is done separately in a separate JIRA.
yutoacts
commented
Sep 7, 2021
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 <yuto.akutsu@nttdata.com> Co-authored-by: Yuto Akutsu <87687356+yutoacts@users.noreply.github.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
sarutak
commented
Sep 14, 2021
We need to change |
HyukjinKwon
commented
Sep 14, 2021
Yup |
yutoacts
commented
Sep 15, 2021
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 <yuto.akutsu@oss.nttdata.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
### 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 <yuto.akutsu@oss.nttdata.com> Signed-off-by: Kousuke Saruta <sarutak@oss.nttdata.com>
### 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 <yuto.akutsu@oss.nttdata.com> Signed-off-by: Kousuke Saruta <sarutak@oss.nttdata.com>
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.