@@ -38,7 +38,6 @@ use datafusion_functions_aggregate::expr_fn::{
3838 array_agg, avg, avg_distinct, count, count_distinct, max, median, min, sum,
3939 sum_distinct,
4040} ;
41- use datafusion_functions_nested:: expr_fn:: { array_distinct, make_array} ;
4241use datafusion_functions_nested:: make_array:: make_array_udf;
4342use datafusion_functions_window:: expr_fn:: { first_value, lead, row_number} ;
4443use insta:: assert_snapshot;
@@ -6526,26 +6525,11 @@ async fn array_distinct_on_list_with_inner_nullability_causing_type_mismatch(
65266525 let ctx = SessionContext :: new ( ) ;
65276526
65286527 ctx. register_batch ( "array_batch" , batch) . unwrap ( ) ;
6529- let df = ctx. table ( " array_batch") . await . unwrap ( ) ;
6528+ let df = ctx. sql ( "select * from array_batch") . await . unwrap ( ) ;
65306529
65316530 // view_all
65326531 assert_snapshot ! (
6533- batches_to_string( & df. clone( ) . collect( ) . await . unwrap( ) ) ,
6534- @r"
6535- +--------------+-------------+
6536- | nonnullable | nullable |
6537- +--------------+-------------+
6538- | [1, 1, 2, 2] | [1, 1, 2, ] |
6539- +--------------+-------------+
6540- "
6541- ) ;
6542-
6543- // non-nullable filter
6544- let filter_expr =
6545- array_distinct ( col ( "nonnullable" ) ) . eq ( make_array ( vec ! [ lit( 1 ) , lit( 2 ) ] ) ) ;
6546- let result_df = df. clone ( ) . filter ( filter_expr) . unwrap ( ) ;
6547- assert_snapshot ! (
6548- batches_to_string( & result_df. collect( ) . await . unwrap( ) ) ,
6532+ batches_to_string( & df. collect( ) . await . unwrap( ) ) ,
65496533 @r"
65506534 +--------------+-------------+
65516535 | nonnullable | nullable |
@@ -6555,15 +6539,19 @@ async fn array_distinct_on_list_with_inner_nullability_causing_type_mismatch(
65556539 "
65566540 ) ;
65576541
6558- // nullable filter
6559- let filter_expr = array_distinct ( col ( "nullable" ) ) . eq ( make_array ( vec ! [
6560- lit( ScalarValue :: Int32 ( None ) ) ,
6561- lit( 1 ) ,
6562- lit( 2 ) ,
6563- ] ) ) ;
6564- let result_df = df. clone ( ) . filter ( filter_expr) . unwrap ( ) ;
6542+ let df = ctx
6543+ . sql (
6544+ r#"
6545+ SELECT * FROM array_batch
6546+ WHERE
6547+ array_distinct(nonnullable) = [1, 2]
6548+ AND array_distinct(nullable) = [NULL, 1, 2]
6549+ "# ,
6550+ )
6551+ . await
6552+ . unwrap ( ) ;
65656553 assert_snapshot ! (
6566- batches_to_string( & result_df . collect( ) . await . unwrap( ) ) ,
6554+ batches_to_string( & df . collect( ) . await . unwrap( ) ) ,
65676555 @r"
65686556 +--------------+-------------+
65696557 | nonnullable | nullable |
0 commit comments