@@ -473,6 +473,64 @@ func TestWriteEmptyLists(t *testing.T) {
473
473
require .NoError (t , err )
474
474
}
475
475
476
+ func TestWriteAllNullsWithDeltaEncoding (t * testing.T ) {
477
+ sc := arrow .NewSchema ([]arrow.Field {
478
+ {Name : "f1" , Type : arrow .PrimitiveTypes .Int64 , Nullable : true },
479
+ {Name : "f2" , Type : arrow .ListOf (arrow .FixedWidthTypes .Date32 )},
480
+ {Name : "f3" , Type : arrow .BinaryTypes .String , Nullable : true },
481
+ {Name : "f4" , Type : arrow .ListOf (arrow .BinaryTypes .String )},
482
+ {Name : "f5" , Type : arrow .BinaryTypes .LargeString , Nullable : true },
483
+ {Name : "f6" , Type : arrow .ListOf (arrow .BinaryTypes .LargeString )},
484
+ {Name : "f7" , Type : arrow .PrimitiveTypes .Float64 , Nullable : true },
485
+ {Name : "f8" , Type : arrow .ListOf (arrow .FixedWidthTypes .Date64 )},
486
+ {Name : "f9" , Type : arrow .BinaryTypes .String , Nullable : true },
487
+ {Name : "f10" , Type : arrow .ListOf (arrow .BinaryTypes .LargeString )},
488
+ {Name : "f11" , Type : arrow .FixedWidthTypes .Boolean , Nullable : true },
489
+ {Name : "f12" , Type : arrow .ListOf (arrow .FixedWidthTypes .Boolean )},
490
+ {Name : "f13" , Type : arrow .PrimitiveTypes .Int32 , Nullable : true },
491
+ {Name : "f14" , Type : arrow .ListOf (arrow .PrimitiveTypes .Float32 )},
492
+ }, nil )
493
+ bldr := array .NewRecordBuilder (memory .DefaultAllocator , sc )
494
+ defer bldr .Release ()
495
+ for _ , b := range bldr .Fields () {
496
+ b .AppendNull ()
497
+ }
498
+
499
+ rec := bldr .NewRecord ()
500
+ defer rec .Release ()
501
+
502
+ props := parquet .NewWriterProperties (
503
+ parquet .WithVersion (parquet .V1_0 ),
504
+ parquet .WithDictionaryDefault (false ),
505
+ parquet .WithDictionaryFor ("f9" , true ),
506
+ parquet .WithDictionaryFor ("f10" , true ),
507
+ parquet .WithDictionaryFor ("f13" , true ),
508
+ parquet .WithDictionaryFor ("f14" , true ),
509
+ parquet .WithEncodingFor ("f1" , parquet .Encodings .DeltaBinaryPacked ),
510
+ parquet .WithEncodingFor ("f2" , parquet .Encodings .DeltaBinaryPacked ),
511
+ parquet .WithEncodingFor ("f3" , parquet .Encodings .DeltaByteArray ),
512
+ parquet .WithEncodingFor ("f4" , parquet .Encodings .DeltaByteArray ),
513
+ parquet .WithEncodingFor ("f5" , parquet .Encodings .DeltaLengthByteArray ),
514
+ parquet .WithEncodingFor ("f6" , parquet .Encodings .DeltaLengthByteArray ),
515
+ parquet .WithEncodingFor ("f7" , parquet .Encodings .Plain ),
516
+ parquet .WithEncodingFor ("f8" , parquet .Encodings .Plain ),
517
+ parquet .WithEncodingFor ("f9" , parquet .Encodings .Plain ),
518
+ parquet .WithEncodingFor ("f10" , parquet .Encodings .Plain ),
519
+ parquet .WithEncodingFor ("f11" , parquet .Encodings .RLE ),
520
+ parquet .WithEncodingFor ("f12" , parquet .Encodings .RLE ),
521
+ parquet .WithEncodingFor ("f13" , parquet .Encodings .RLE ),
522
+ parquet .WithEncodingFor ("f14" , parquet .Encodings .RLE ),
523
+ )
524
+ arrprops := pqarrow .DefaultWriterProps ()
525
+ var buf bytes.Buffer
526
+ fw , err := pqarrow .NewFileWriter (sc , & buf , props , arrprops )
527
+ require .NoError (t , err )
528
+ err = fw .Write (rec )
529
+ require .NoError (t , err )
530
+ err = fw .Close ()
531
+ require .NoError (t , err )
532
+ }
533
+
476
534
func TestArrowReadWriteTableChunkedCols (t * testing.T ) {
477
535
chunkSizes := []int {2 , 4 , 10 , 2 }
478
536
const totalLen = int64 (18 )
0 commit comments