|
295 | 295 | @test isequal(tt.a, ['a', missing]) |
296 | 296 | end |
297 | 297 |
|
| 298 | + @testset "# offset bool write paths" begin |
| 299 | + t = ( |
| 300 | + a=OffsetArray(Bool[true, false, true], -1:1), |
| 301 | + b=OffsetArray(Union{Missing,Bool}[true, missing, false], -1:1), |
| 302 | + c=OffsetArray(Any[true, false, true], -1:1), |
| 303 | + d=OffsetArray(Any[true, missing, false], -1:1), |
| 304 | + ) |
| 305 | + tt = Arrow.Table(Arrow.tobuffer(t)) |
| 306 | + @test tt.a == Bool[true, false, true] |
| 307 | + @test isequal(tt.b, Union{Missing,Bool}[true, missing, false]) |
| 308 | + @test tt.c == Bool[true, false, true] |
| 309 | + @test isequal(tt.d, Union{Missing,Bool}[true, missing, false]) |
| 310 | + end |
| 311 | + |
| 312 | + @testset "# offset primitive write paths" begin |
| 313 | + t = ( |
| 314 | + a=OffsetArray(Int64[1, 2, 3], -1:1), |
| 315 | + b=OffsetArray(Union{Missing,Int64}[1, missing, 3], -1:1), |
| 316 | + c=OffsetArray(Any[1, 2, 3], -1:1), |
| 317 | + d=OffsetArray(Any[1, missing, 3], -1:1), |
| 318 | + ) |
| 319 | + tt = Arrow.Table(Arrow.tobuffer(t)) |
| 320 | + @test tt.a == Int64[1, 2, 3] |
| 321 | + @test isequal(tt.b, Union{Missing,Int64}[1, missing, 3]) |
| 322 | + @test tt.c == Int64[1, 2, 3] |
| 323 | + @test isequal(tt.d, Union{Missing,Int64}[1, missing, 3]) |
| 324 | + end |
| 325 | + |
298 | 326 | @testset "# automatic custom struct serialization/deserialization" begin |
299 | 327 | t = (col1=[CustomStruct(1, 2.3, "hey"), CustomStruct(4, 5.6, "there")],) |
300 | 328 |
|
@@ -974,6 +1002,18 @@ end |
974 | 1002 | @test isequal(t1.bm, t2.bm) |
975 | 1003 | @test isequal(t1.c, t2.c) |
976 | 1004 | @test isequal(t1.cm, t2.cm) |
| 1005 | + |
| 1006 | + toffset = ( |
| 1007 | + b=OffsetArray([b"01", b"", b"3"], -1:1), |
| 1008 | + bm=OffsetArray(Union{Missing,Base.CodeUnits{UInt8,String}}[b"01", b"3", missing], -1:1), |
| 1009 | + c=OffsetArray(["a", "b", "c"], -1:1), |
| 1010 | + cm=OffsetArray(Union{Missing,String}["a", "c", missing], -1:1), |
| 1011 | + ) |
| 1012 | + ttoffset = Arrow.Table(Arrow.tobuffer(toffset)) |
| 1013 | + @test collect(toffset.b) == ttoffset.b |
| 1014 | + @test isequal(collect(toffset.bm), ttoffset.bm) |
| 1015 | + @test collect(toffset.c) == ttoffset.c |
| 1016 | + @test isequal(collect(toffset.cm), ttoffset.cm) |
977 | 1017 | end |
978 | 1018 |
|
979 | 1019 | @testset "# 435" begin |
|
0 commit comments