Appending strings after reading a buffer can change their contents
perfloop-oss/parquet-go · Round-trip loss
https://perfloop.ai/t/oss/case_w1dx1faw8z
Verdict
VERIFIED · settled 2026-11-22 · merged as parquet-go/parquet-go#722
What happened: The check fails before this change and passes with it.
Hypothesis
Appending rows to a buffer after reading its contents can change an appended string. This violates the ordinary buffer write/read round trip. Application occurrence is unmeasured.
At 90bee42a64b670cb55f054a8b26e72381b825611, byteArrayColumnBuffer.page appends a terminal offset after the value offsets. byteArrayColumnBuffer.writeValues uses offsets.Len() as its append position, but uses lengths.Len() for the corresponding lengths. After a page has been read these positions differ by one.
A public GenericBuffer write/sort/read, append, sort/read probe returned the string "appended nul" for a row written with "appended low" immediately after "appended null". The same payload change occurs on the accepted source and with the independent optional-key sorting repair. An ascending null-last control has identical full row fields on both sources after ordering by the required ID key. A smaller replay should remove optional keys and isolate the page/write offset mismatch. The independent proof target is exact preservation of appended strings after materialization, including unequal lengths, empty strings, repeated appends, and reset controls.
Change to test: Make batch writes resume at the number of existing values rather than past the terminal page offset. Check all write entry points that can follow page materialization and preserve ordinary page and buffer round trips.
Where it lives
Evidence
The check fails before this change and passes with it: `GenericBuffer preserves every row ID and string in the tested write/sort/read, append/sort/read sequences with unequal lengths, empty strings, repeated appends and Reset reuse.`
The check fails before this change and passes with it: `Byte-array column buffers preserve the tested PLAIN, primitive-conversion and null values after appending to a materialized page, with one starting offset per stored value after writing, and preserve those values after swapping and cloning through direct and page reads.`
Boolean-to-string appends · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
9.261 |
10.09 |
+8.9% (+0.825) |
+0.534 to +1.227 |
loss ≤ stated 0.3 × |baseline median| |
PASSED |
Int32-to-string appends · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
11.41 |
13.05 |
+15.3% (+1.75) |
+1.16 to +2.25 |
loss ≤ stated 0.4 × |baseline median| |
PASSED |
Int64-to-string appends · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
11.89 |
12.68 |
+6.2% (+0.74) |
+0.14 to +1.21 |
loss ≤ stated 0.25 × |baseline median| |
PASSED |
Float32-to-string appends · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
17.8 |
19.18 |
+8.1% (+1.44) |
+0.42 to +2.56 |
loss ≤ stated 0.4 × |baseline median| |
PASSED |
Float64-to-string appends · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
17.45 |
17.72 |
+0.08 |
−0.7 to +1.03 |
loss ≤ stated 0.25 × |baseline median| |
PASSED |
Page after cancelling swaps · 36 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
491.2 |
497.4 |
+6.05 |
−6.9 to +23.7 |
loss ≤ 0.05 × |baseline median| |
PASSED |
Pages after cancelling swaps · 31 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
537.5 |
541 |
+3.4 |
−22.9 to +25.1 |
loss ≤ 0.05 × |baseline median| |
PASSED |
ColumnIndex after cancelling swaps · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
495.8 |
506 |
+9.3 |
−19.3 to +21.1 |
loss ≤ 0.05 × |baseline median| |
PASSED |
OffsetIndex after cancelling swaps · 44 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
494.7 |
501.3 |
+6.7 |
−11.9 to +24 |
loss ≤ 0.05 × |baseline median| |
PASSED |
Raw byte-array append empty · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
7.017 |
7.572 |
+0.484 |
−0.062 to +1.109 |
loss ≤ stated 0.5 × |baseline median| |
PASSED |
Raw byte-array append one byte · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
7.812 |
8.305 |
+6.6% (+0.512) |
+0.091 to +0.85 |
loss ≤ stated 0.25 × |baseline median| |
PASSED |
Page with two empty values · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
83.2 |
86.8 |
+2.85 |
−2.99 to +14.29 |
loss ≤ stated 0.6 × |baseline median| |
PASSED |
Page with empty and nonempty values · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
116.2 |
135 |
+17% (+19.7) |
+5.9 to +27.1 |
loss ≤ stated 0.8 × |baseline median| |
PASSED |
Page with cancelled empty swaps · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
493 |
5530 |
+1021% (+5034) |
+4783 to +6891 |
loss ≤ stated 50 × |baseline median| |
PASSED |
Pages with two empty values · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
124.5 |
125.9 |
+1.9 |
−16.4 to +14.2 |
loss ≤ stated 0.6 × |baseline median| |
PASSED |
Pages with empty and nonempty values · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
165.5 |
182.5 |
+16.7 |
−0.5 to +29.1 |
loss ≤ stated 0.8 × |baseline median| |
PASSED |
Pages with cancelled empty swaps · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
545.8 |
5591 |
+923.6% (+5041) |
+4902 to +6331 |
loss ≤ stated 50 × |baseline median| |
PASSED |
ColumnIndex with two empty values · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
83.57 |
85.14 |
+1.59 |
−3.08 to +12.04 |
loss ≤ stated 0.6 × |baseline median| |
PASSED |
ColumnIndex with empty and nonempty values · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
117 |
131.8 |
+14.1 |
−7.7 to +27.1 |
loss ≤ stated 0.8 × |baseline median| |
PASSED |
ColumnIndex with cancelled empty swaps · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
495.1 |
5452 |
+997% (+4936) |
+4838 to +5780 |
loss ≤ stated 50 × |baseline median| |
PASSED |
OffsetIndex with two empty values · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
86.16 |
87.54 |
+2.81 |
−20.47 to +16.25 |
loss ≤ stated 0.6 × |baseline median| |
PASSED |
OffsetIndex with empty and nonempty values · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
116.1 |
133.6 |
+16 |
−36.1 to +32.4 |
loss ≤ stated 0.8 × |baseline median| |
PASSED |
OffsetIndex with cancelled empty swaps · 21 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
493.5 |
5474 |
+1009% (+4979) |
+4899 to +7499 |
loss ≤ stated 50 × |baseline median| |
PASSED |
Page of a zero-row byte-array buffer · 22 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
5.924 |
6.232 |
+0.2955 |
−0.018 to +1.82 |
loss ≤ stated 0.7 × |baseline median| |
PASSED |
ColumnIndex of a zero-row byte-array buffer · 22 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
6.475 |
6.846 |
+0.4015 |
−0.643 to +1.023 |
loss ≤ stated 0.4 × |baseline median| |
PASSED |
OffsetIndex of a zero-row byte-array buffer · 22 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
6.74 |
7.411 |
+9.8% (+0.661) |
+0.412 to +2.221 |
loss ≤ stated 0.5 × |baseline median| |
PASSED |
Re-sort rows with nonempty strings · 22 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
570460 |
648377 |
+13.5% (+76829) |
+39446 to +196893 |
loss ≤ stated 0.5 × |baseline median| |
PASSED |
Re-sort rows with one percent empty strings · 22 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
564810 |
636075 |
+69641 |
−41866 to +136428 |
loss ≤ stated 0.5 × |baseline median| |
PASSED |
Re-sort rows with half empty strings · 22 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
568722 |
637718 |
+11.9% (+67667) |
+36192 to +144931 |
loss ≤ stated 0.5 × |baseline median| |
PASSED |
True Boolean-to-string appends · 22 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
ns/op |
8.926 |
10.11 |
+13.7% (+1.219) |
+0.724 to +1.75 |
loss ≤ stated 0.6 × |baseline median| |
PASSED |
Checks: 14 of 14 passed. Verification: no defect found.