|
264 | 264 | @test all(isequal.(values(t), values(tt))) |
265 | 265 | end |
266 | 266 |
|
| 267 | + @testset "View buffer count inference" begin |
| 268 | + inline_len = Int32(Arrow.VIEW_INLINE_BYTES) |
| 269 | + views = Arrow.ViewElement[ |
| 270 | + Arrow.ViewElement(inline_len, Int32(0), Int32(0), Int32(0)), |
| 271 | + Arrow.ViewElement(inline_len + Int32(148), Int32(0), Int32(0), Int32(0)), |
| 272 | + Arrow.ViewElement(inline_len + Int32(207), Int32(0), Int32(1), Int32(160)), |
| 273 | + ] |
| 274 | + validity = Arrow.ValidityBitmap(UInt8[], 1, length(views), 0) |
| 275 | + @test Arrow._viewisinline(inline_len) |
| 276 | + @test !Arrow._viewisinline(inline_len + Int32(1)) |
| 277 | + @test Arrow._viewbuffercount(validity, views, Int32(0)) == 2 |
| 278 | + @test Arrow._viewbuffercount(validity, views, Int32(1)) == 2 |
| 279 | + @test Arrow._viewbuffercount(validity, views, Int32(3)) == 3 |
| 280 | + |
| 281 | + sparse_validity = Arrow.ValidityBitmap(UInt8[0x05], 1, 3, 1) |
| 282 | + sparse_views = Arrow.ViewElement[ |
| 283 | + Arrow.ViewElement(inline_len + Int32(64), Int32(0), Int32(0), Int32(0)), |
| 284 | + Arrow.ViewElement(inline_len + Int32(64), Int32(0), Int32(99), Int32(0)), |
| 285 | + Arrow.ViewElement(inline_len, Int32(0), Int32(0), Int32(0)), |
| 286 | + ] |
| 287 | + @test !sparse_validity[2] |
| 288 | + @test Arrow._viewbuffercount(sparse_validity, sparse_views, Int32(0)) == 1 |
| 289 | + end |
| 290 | + |
267 | 291 | @testset "single-partition tobuffer byte equivalence" begin |
268 | 292 | t = (col=OffsetArray(["a", "bc", "def"], 0:2),) |
269 | 293 | io = IOBuffer() |
|
0 commit comments