andygrove commented on code in PR #67:
URL: https://github.com/apache/datafusion-spark/pull/67#discussion_r4566763401
##########
crates/spark/src/function/math/pow.rs:
##########
@@ -112,20 +110,11 @@ impl ScalarUDFImpl for SparkPow {
.downcast_ref::<Float64Array>()
.expect("exponent must be Float64Array");
- // Spark: 0^negative = +Infinity (covers both 0.0 and -0.0)
- // IEEE 754: 0.0^-1.0 = +Infinity, -0.0^-1.0 = -Infinity
- // Thus we need an explicit guard for base == 0.0 to ensure +Infinity.
let result: Float64Array = base_f64
.iter()
.zip(exp_f64.iter())
.map(|(base, exp)| match (base, exp) {
- (Some(base), Some(exp)) => {
- if base == 0.0 && exp < 0.0 {
- Some(f64::INFINITY)
- } else {
- Some(base.powf(exp))
- }
- }
+ (Some(base), Some(exp)) => Some(spark_pow(base, exp)),
Review Comment:
Done in 09d2119. Behaviour is unchanged: a row is null if either input is
null.
--
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]