`Arrow.Table` uses last dictionary for all batches in streaming decode, resulting in incorrect reads
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Bắt đầu bằng cách so sánh các đường dẫn giải mã streaming được Arrow.Table và Arrow.Stream sử dụng với trình tái hiện hai batch trong issue. Theo dõi cách mỗi DictionaryBatch được áp dụng khi đọc combined.arrows, sau đó xác minh rằng kết quả của bảng giữ nguyên ["alpha", "beta", "gamma", "delta"] giống như Arrow.Stream và pyarrow.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
This issue was primarily written by AI, but checked by a person. The practical upshot is that data is read back differently than it was written.
Example:
Here's a 2-batch stream where the second DictionaryBatch replaces (not deltas) the dictionary for column a: batch 1 uses ["alpha","beta"], batch 2 uses ["gamma","delta"]. Reading it back with Arrow.Table gives ["gamma","delta","gamma","delta"] instead of ["alpha","beta","gamma","delta"]; Arrow.Stream on the same bytes gives the correct answer.
using Arrow
# Two independent single-batch streams, same schema, different dict pools.
# Each is written fresh, so each DictionaryBatch is "initial" (isDelta=false) —
# exactly what a producer like pyarrow emits when per-batch pools differ.
open(io -> Arrow.write(io, (a=Arrow.DictEncode(["alpha", "beta"]),)), "s1.arrows", "w")
open(io -> Arrow.write(io, (a=Arrow.DictEncode(["gamma", "delta"]),)), "s2.arrows", "w")
# Splice: [schema, dict1, rb1] from s1 + [dict2, rb2] from s2 + EOS.
# This reproduces a foreign stream whose 2nd DictionaryBatch replaces dict id 0.
function messages(bytes)
spans, pos = UnitRange{Int}[], 1
while pos + 3 <= length(bytes) && Arrow.readbuffer(bytes, pos, UInt32) == Arrow.CONTINUATION_INDICATOR_BYTES
pos += 4
msglen = Arrow.readbuffer(bytes, pos, Int32)
msglen == 0 && break
pos += 4
msg = Arrow.FlatBuffers.getrootas(Arrow.Meta.Message, bytes, pos - 1)
start = pos - 8
pos += msglen + msg.bodyLength
push!(spans, start:(pos - 1))
end
spans
end
b1, b2 = read("s1.arrows"), read("s2.arrows")
s1, s2 = messages(b1), messages(b2)
eos = reinterpret(UInt8, [Arrow.CONTINUATION_INDICATOR_BYTES, UInt32(0)])
write("combined.arrows", vcat(b1[s1[1]], b1[s1[2]], b1[s1[3]], b2[s2[2]], b2[s2[3]], eos))
println(collect(Arrow.Table("combined.arrows").a)) # ["gamma","delta","gamma","delta"] -- WRONG
println([collect(b.a) for b in Arrow.Stream("combined.arrows")]) # [["alpha","beta"],["gamma","delta"]] -- correct
The pyarrow version behaves correctly in this case:
import pyarrow as pa, pyarrow.ipc as ipc
b1 = pa.record_batch({'a': pa.DictionaryArray.from_arrays(
pa.array([0, 1], pa.int32()), pa.array(['alpha', 'beta']))})
b2 = pa.record_batch({'a': pa.DictionaryArray.from_arrays(
pa.array([0, 1], pa.int32()), pa.array(['gamma', 'delta']))})
with ipc.new_stream('r2.arrows', b1.schema) as w:
w.write_batch(b1); w.write_batch(b2)
ipc.open_stream('r2.arrows').read_all().column(0).to_pylist()
# ['alpha', 'beta', 'gamma', 'delta']
- Ngôn ngữ chính
- Julia
- Star
- 315
- Fork
- 79
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/arrow-julia
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
apache/arrow-julia#597 ·
-
BoundsError: attempt to access 0-element Vector{Vector{UInt8}} at index [1]Có thể đã có người làm @quinnj đã nhận 40 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
apache/arrow-julia#590 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
apache/arrow-julia#589 · 2 bình luận ·
-
Test failures with CategoricalArrays 1.0Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
apache/arrow-julia#586 · 2 bình luận ·
-
`Arrow.Stream` not working with non-seekable I/O e.g. FIFOs and socketsCó thể đã có người làm @quinnj đã nhận 290 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
apache/arrow-julia#580 ·
Tất cả issue của apache/arrow-julia
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
JuliaLang/LinearAlgebra.jl#1834 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
MagneticResonanceImaging/MRIReco.jl#332 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
chalk-lab/Mooncake.jl#1423 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 70/100
WaterLily-jl/WaterLily.jl#376 ·
Maintainer thường phản hồi trong vòng 1 ngày