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

Function test_inlist_nullability

datafusion/expr/src/expr_schema.rs:985–1008  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

983
984 #[test]
985 fn test_inlist_nullability() {
986 let get_schema = |nullable| {
987 MockExprSchema::new()
988 .with_data_type(DataType::Int32)
989 .with_nullable(nullable)
990 };
991
992 let expr = col("foo").in_list(vec![lit(1); 5], false);
993 assert!(!expr.nullable(&get_schema(false)).unwrap());
994 assert!(expr.nullable(&get_schema(true)).unwrap());
995 // Testing nullable() returns an error.
996 assert!(
997 expr.nullable(&get_schema(false).with_error_on_nullable(true))
998 .is_err()
999 );
1000
1001 let null = lit(ScalarValue::Int32(None));
1002 let expr = col("foo").in_list(vec![null, lit(1)], false);
1003 assert!(expr.nullable(&get_schema(false)).unwrap());
1004
1005 // Testing on long list
1006 let expr = col("foo").in_list(vec![lit(1); 6], false);
1007 assert!(expr.nullable(&get_schema(false)).unwrap());
1008 }
1009
1010 #[test]
1011 fn test_like_nullability() {

Callers

nothing calls this directly

Calls 6

newFunction · 0.85
with_data_typeMethod · 0.80
in_listMethod · 0.80
colFunction · 0.70
litFunction · 0.70
with_nullableMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…