@@ -10,6 +10,44 @@ import (
1010 "time"
1111)
1212
13+ func TestWithTestIgnoreNullsInLists (t * testing.T ) {
14+ s := & WriterTestSuite {ignoreNullsInLists : true }
15+
16+ tg := schema .NewTestDataGenerator ()
17+ source := schema .TestTable ("ignore_nulls_in_lists" , schema.TestSourceOptions {})
18+ resource := s .handleNulls (tg .Generate (source , schema.GenTestDataOptions {
19+ SourceName : "allow_null" ,
20+ SyncTime : time .Now (),
21+ MaxRows : 100 ,
22+ NullRows : false ,
23+ })[0 ])
24+ for _ , c := range resource .Columns () {
25+ assertNoNullsInLists (t , c )
26+ }
27+
28+ resource = s .handleNulls (tg .Generate (source , schema.GenTestDataOptions {
29+ SourceName : "ignore_nulls_in_lists" ,
30+ SyncTime : time .Now (),
31+ MaxRows : 100 ,
32+ NullRows : true ,
33+ })[0 ])
34+ for _ , c := range resource .Columns () {
35+ assertNoNullsInLists (t , c )
36+ }
37+ }
38+
39+ func assertNoNullsInLists (t * testing.T , arr arrow.Array ) {
40+ // traverse
41+ switch arr := arr .(type ) {
42+ case array.ListLike :
43+ assert .Zero (t , arr .ListValues ().NullN ())
44+ case * array.Struct :
45+ for i := 0 ; i < arr .NumField (); i ++ {
46+ assertNoNullsInLists (t , arr .Field (i ))
47+ }
48+ }
49+ }
50+
1351func TestWithTestSourceAllowNull (t * testing.T ) {
1452 s := & WriterTestSuite {allowNull : func (dt arrow.DataType ) bool {
1553 switch dt .(type ) {
0 commit comments