()
| 707 | |
| 708 | #[test] |
| 709 | fn test_log_f32() { |
| 710 | let arg_fields = vec![ |
| 711 | Field::new("a", DataType::Float32, false).into(), |
| 712 | Field::new("a", DataType::Float32, false).into(), |
| 713 | ]; |
| 714 | let args = ScalarFunctionArgs { |
| 715 | args: vec![ |
| 716 | ColumnarValue::Array(Arc::new(Float32Array::from(vec![ |
| 717 | 2.0, 2.0, 3.0, 5.0, |
| 718 | ]))), // base |
| 719 | ColumnarValue::Array(Arc::new(Float32Array::from(vec![ |
| 720 | 8.0, 4.0, 81.0, 625.0, |
| 721 | ]))), // num |
| 722 | ], |
| 723 | arg_fields, |
| 724 | number_rows: 4, |
| 725 | return_field: Field::new("f", DataType::Float32, true).into(), |
| 726 | config_options: Arc::new(ConfigOptions::default()), |
| 727 | }; |
| 728 | let result = LogFunc::new() |
| 729 | .invoke_with_args(args) |
| 730 | .expect("failed to initialize function log"); |
| 731 | |
| 732 | match result { |
| 733 | ColumnarValue::Array(arr) => { |
| 734 | let floats = as_float32_array(&arr) |
| 735 | .expect("failed to convert result to a Float32Array"); |
| 736 | |
| 737 | assert_eq!(floats.len(), 4); |
| 738 | assert!((floats.value(0) - 3.0).abs() < f32::EPSILON); |
| 739 | assert!((floats.value(1) - 2.0).abs() < f32::EPSILON); |
| 740 | assert!((floats.value(2) - 4.0).abs() < f32::EPSILON); |
| 741 | assert!((floats.value(3) - 4.0).abs() < f32::EPSILON); |
| 742 | } |
| 743 | ColumnarValue::Scalar(_) => { |
| 744 | panic!("Expected an array value") |
| 745 | } |
| 746 | } |
| 747 | } |
| 748 | #[test] |
| 749 | // Test log() simplification errors |
| 750 | fn test_log_simplify_errors() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…