Skip to content

Commit de59e48

Browse files
authored
Fix bug where inline bytes weren't valid for Utf8View data (#548)
Fixed a follow up bug to #511
1 parent 464470a commit de59e48

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

src/table.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,8 @@ function build(
881881
validity = buildbitmap(batch, rb, nodeidx, bufferidx)
882882
bufferidx += 1
883883
buffer = rb.buffers[bufferidx]
884-
inline, views = reinterp(ViewElement, batch, buffer, rb.compression)
884+
_, views = reinterp(ViewElement, batch, buffer, rb.compression)
885+
inline = reinterpret(UInt8, views) # reuse the (possibly realigned) memory backing `views`
885886
bufferidx += 1
886887
buffers = Vector{UInt8}[]
887888
for i = 1:rb.variadicBufferCounts[varbufferidx]

test/reject_reason_trimmed.arrow

1.12 KB
Binary file not shown.

test/runtests.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,16 @@ end
10691069
tbl = Arrow.Table(Arrow.tobuffer(tt[2]))
10701070
@test tbl.col16[1] == Dates.Time(0, 0, 0)
10711071
end
1072+
1073+
@testset "#511: Bug in reading Utf8View data" begin
1074+
t = Arrow.Table(
1075+
joinpath(
1076+
dirname(pathof(Arrow)),
1077+
"../test/reject_reason_trimmed.arrow",
1078+
),
1079+
)
1080+
@test t.reject_reason[end] == "POST_ONLY"
1081+
end
10721082
end # @testset "misc"
10731083

10741084
@testset "DataAPI.metadata" begin

0 commit comments

Comments
 (0)