Converts an array of any numeric type to a Float64Array.
(array: &ArrayRef)
| 235 | |
| 236 | /// Converts an array of any numeric type to a Float64Array. |
| 237 | fn convert_to_f64_array(array: &ArrayRef) -> Result<Float64Array> { |
| 238 | match array.data_type() { |
| 239 | DataType::Float64 => Ok(as_float64_array(array)?.clone()), |
| 240 | DataType::Float32 => { |
| 241 | let array = as_float32_array(array)?; |
| 242 | let converted: Float64Array = |
| 243 | array.iter().map(|v| v.map(|v| v as f64)).collect(); |
| 244 | Ok(converted) |
| 245 | } |
| 246 | DataType::Int64 => { |
| 247 | let array = as_int64_array(array)?; |
| 248 | let converted: Float64Array = |
| 249 | array.iter().map(|v| v.map(|v| v as f64)).collect(); |
| 250 | Ok(converted) |
| 251 | } |
| 252 | DataType::Int32 => { |
| 253 | let array = as_int32_array(array)?; |
| 254 | let converted: Float64Array = |
| 255 | array.iter().map(|v| v.map(|v| v as f64)).collect(); |
| 256 | Ok(converted) |
| 257 | } |
| 258 | _ => exec_err!("Unsupported array type for conversion to Float64Array"), |
| 259 | } |
| 260 | } |
no test coverage detected
searching dependent graphs…