KarpagamKarthikeyan opened a new issue, #23961:
URL: https://github.com/apache/datafusion/issues/23961

   ### Is your feature request related to a problem or challenge?
   
   The `datafusion-spark` function library (tracked in #15914) is building out 
Spark SQL–compatible functions. Spark provides [`atan2(exprY, 
exprX)`](https://spark.apache.org/docs/latest/api/sql/#atan2), which returns 
the angle in radians between the positive x-axis and the point given by the 
coordinates (`exprX`, `exprY`).
   
   It is not yet implemented in `datafusion-spark` — there is an auto-generated 
test stub at `datafusion/sqllogictest/test_files/spark/math/atan2.slt` with its 
query commented out, but no implementation registered in the Spark function 
library.
   
   ### Describe the solution you'd like
   
   Add a Spark-compatible `atan2` scalar function to `datafusion-spark`, 
following the existing `math` function pattern (e.g. `hypot.rs`):
   
   - Add `SparkAtan2` (implementing `ScalarUDFImpl`) in 
`datafusion/spark/src/function/math/atan2.rs`, computing `y.atan2(x)` 
element-wise via the Arrow `binary` kernel.
   - Register it in `datafusion/spark/src/function/math/mod.rs`.
   - Enable the existing `atan2.slt` sqllogictest.
   
   Signature: `exact(Float64, Float64) -> Float64`, following the 
`datafusion-spark` convention of only accepting Spark-supported types. NULL in 
either argument propagates to NULL.
   
   ### Describe alternatives you've considered
   
   DataFusion core already has an `atan2` function, so one alternative is to 
delegate to it. However, the `datafusion-spark` crate reimplements functions 
self-contained rather than aliasing core — 14 of the 15 existing `math` 
functions do so (including `abs`, `ceil`, `floor`, `round`, `rint`, which all 
exist in core as well); only `pow` delegates, and that is a special case where 
Spark differs from core in one edge case. A self-contained `atan2` keeps the 
Spark function library complete and consistent, matching that convention.
   
   ### Additional context
   
   Part of #15914 (Complete `datafusion-spark` Spark Compatible Functions). 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to