(value: i256, scale: i8, base: f64)
| 171 | } |
| 172 | |
| 173 | fn log_decimal256(value: i256, scale: i8, base: f64) -> Result<f64, ArrowError> { |
| 174 | // Try to convert to i128 for the optimized path |
| 175 | match value.to_i128() { |
| 176 | Some(v) => log_decimal128(v, scale, base), |
| 177 | None => { |
| 178 | // For very large Decimal256 values, use f64 computation |
| 179 | let value_f64 = value.to_f64().ok_or_else(|| { |
| 180 | ArrowError::ComputeError(format!("Cannot convert {value} to f64")) |
| 181 | })?; |
| 182 | let scale_factor = 10f64.powi(scale as i32); |
| 183 | Ok((value_f64 / scale_factor).log(base)) |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | impl ScalarUDFImpl for LogFunc { |
| 189 | fn name(&self) -> &str { |
no test coverage detected
searching dependent graphs…