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

Function test_numeric_boundary_values

datafusion/expr-common/src/casts.rs:969–1014  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

967
968 #[test]
969 fn test_numeric_boundary_values() {
970 // Test exact boundary values for signed integers
971 expect_cast(
972 ScalarValue::Int8(Some(i8::MAX)),
973 DataType::UInt8,
974 ExpectedCast::Value(ScalarValue::UInt8(Some(i8::MAX as u8))),
975 );
976
977 expect_cast(
978 ScalarValue::Int8(Some(i8::MIN)),
979 DataType::UInt8,
980 ExpectedCast::NoValue,
981 );
982
983 expect_cast(
984 ScalarValue::UInt8(Some(u8::MAX)),
985 DataType::Int8,
986 ExpectedCast::NoValue,
987 );
988
989 // Test cross-type boundary scenarios
990 expect_cast(
991 ScalarValue::Int32(Some(i32::MAX)),
992 DataType::Int64,
993 ExpectedCast::Value(ScalarValue::Int64(Some(i32::MAX as i64))),
994 );
995
996 expect_cast(
997 ScalarValue::Int64(Some(i64::MIN)),
998 DataType::UInt64,
999 ExpectedCast::NoValue,
1000 );
1001
1002 // Test unsigned to signed edge cases
1003 expect_cast(
1004 ScalarValue::UInt32(Some(u32::MAX)),
1005 DataType::Int32,
1006 ExpectedCast::NoValue,
1007 );
1008
1009 expect_cast(
1010 ScalarValue::UInt64(Some(u64::MAX)),
1011 DataType::Int64,
1012 ExpectedCast::NoValue,
1013 );
1014 }
1015
1016 #[test]
1017 fn test_decimal_precision_limits() {

Callers

nothing calls this directly

Calls 2

expect_castFunction · 0.85
ValueEnum · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…