fix: make tan and atan2 compatible#3849
fix: make tan and atan2 compatible#3849kazuyukitanimura wants to merge 10 commits intoapache:mainfrom
Conversation
|
Thanks @kazuyukitanimura. Could you add SQL file based tests, since this is preferred approach now. See #3854 for example. |
Thanks @andygrove, updated spark/src/test/resources/sql-tests/expressions/math/atan2.sql |
spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala
Outdated
Show resolved
Hide resolved
| override def getSupportLevel(expr: Atan2): SupportLevel = | ||
| Incompatible( | ||
| Some( | ||
| "atan2(-0.0, -0.0) produces incompatible result" + |
There was a problem hiding this comment.
if it is only 1 input value which returns incorrect response, should we just hardcode the response?
There was a problem hiding this comment.
Can done separately. I haven't decided how we should handle this. Because this is more like Spark side issue.
There was a problem hiding this comment.
Actually we need do more tests for atan2 to enable e.g.
atan2(-0.0, -0.0)
atan2(-0.0, +0.0)
atan2(+0.0, -0.0)
atan2(+0.0, +0.0)
atan2(-0.0, -1.0)
atan2(-1.0, -0.0)
atan2(-0.0, +1.0)
atan2(+1.0, -0.0)
...
There was a problem hiding this comment.
@comphead I ended up fixing atan2 as well. Please take a look
Which issue does this PR close?
Closes: #1897
Rationale for this change
#1897 claims
tanis incompatible; however, what is really incompatible isatan2that is failing in the same test in #1896The correct results are
Looks like Spark adds
+0.0to inputs in order to convertatan2(-0.0, -0.0)toatan2(+0.0, +0.0)What changes are included in this PR?
Fixed
atan2and enabledtanHow are these changes tested?