dongjoon-hyun opened a new pull request, #460: URL: https://github.com/apache/spark-connect-swift/pull/460
### What changes were proposed in this pull request? This PR aims to add math functions in a new file, `MathFunctions.swift`. The function names and signatures follow Scala's `org.apache.spark.sql.functions`. | Category | Functions | | --- | --- | | Trigonometric | `sin`, `cos`, `tan`, `asin`, `acos`, `atan`, `atan2`, `cot`, `sec`, `csc` | | Hyperbolic | `sinh`, `cosh`, `tanh`, `asinh`, `acosh`, `atanh` | | Exponential and logarithmic | `exp`, `expm1`, `ln`, `log` (with a `log(base, column)` overload), `log10`, `log1p`, `log2`, `pow`/`power`, `cbrt`, `hypot` | | Rounding and sign | `ceil`/`ceiling`/`floor` (each with a `scale` overload), `rint`, `bround` (HALF_EVEN, with a `scale` overload), `sign`/`signum`, `negative`, `positive` | | Base conversion and bit shift | `bin`, `hex`, `unhex`, `conv`, `shiftleft`, `shiftright`, `shiftrightunsigned` | | Others | `factorial`, `pmod`, `degrees`, `radians`, `e`, `pi`, `width_bucket` | Following Scala, some Swift APIs map to different SQL function names. | Swift API | SQL function | | --- | --- | | `pow`, `power` | `power` | | `log(column)` | `ln` | Deprecated aliases in Scala (`toDegrees`, `toRadians`, `shiftLeft`, `shiftRight`, `shiftRightUnsigned`) are excluded intentionally. ### Why are the changes needed? To improve the usability of the column-based `DataFrame` API by providing math functions in the same shape as Scala/PySpark, so users can write queries without falling back to `selectExpr` or raw SQL strings. ### Does this PR introduce _any_ user-facing change? Yes, this adds new public functions. There is no behavior change to existing APIs. ### How was this patch tested? Pass the CIs with a newly added test suite, `MathFunctionsTests`. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Fable 5 -- 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]
