MCPcopy Create free account
hub / github.com/apache/datafusion / test_cot_scalar_pi

Function test_cot_scalar_pi

datafusion/functions/src/math/cot.rs:334–357  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

332
333 #[test]
334 fn test_cot_scalar_pi() {
335 let arg_fields = vec![Field::new("a", DataType::Float64, false).into()];
336 let args = ScalarFunctionArgs {
337 args: vec![ColumnarValue::Scalar(ScalarValue::Float64(Some(
338 std::f64::consts::PI,
339 )))],
340 arg_fields,
341 number_rows: 1,
342 return_field: Field::new("f", DataType::Float64, false).into(),
343 config_options: Arc::new(ConfigOptions::default()),
344 };
345 let result = CotFunc::new()
346 .invoke_with_args(args)
347 .expect("cot pi should succeed");
348
349 match result {
350 ColumnarValue::Scalar(ScalarValue::Float64(Some(v))) => {
351 // cot(PI) = 1/tan(PI) - very large negative number due to floating point
352 let expected = 1.0_f64 / std::f64::consts::PI.tan();
353 assert!((v - expected).abs() < 1e-6);
354 }
355 _ => panic!("Expected Float64 scalar"),
356 }
357 }
358}

Callers

nothing calls this directly

Calls 3

newFunction · 0.85
intoMethod · 0.45
invoke_with_argsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…