hcrosse opened a new issue, #1521:
URL: https://github.com/apache/arrow-go/issues/1521

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   `SeekToRow` on a repeated column with V1 pages can return wrong rows without 
an error. It can also fail with `number of decoded rep/def levels did not 
match` or panic. V2 pages do not have this problem.
   
   I reproduced this on v18.6.0, v18.7.0 and v18.8.0, with Go 1.27.3 on macOS 
arm64. The code involved is unchanged on main.
   
   I wrote a nullable `list<int32>` column containing `[1,2,3,4]`, `[5]`, 
`[6]`, `[7,8]` with `pqarrow.WriteTable`. I used two rows per row group and 
`WithDataPageVersion(parquet.DataPageV1)`. I read it through 
`pqarrow.NewFileReader` and `GetRecordReader` with a batch size of 10. I called 
`SeekToRow(1)` and read to the end. It returned `[5]`, `[6,7,8]` instead of 
`[5]`, `[6]`, `[7,8]`. V2 pages return the expected rows.
   
   **Cause**
   
   `skipRows` fills `c.repLvlBuffer`. `readRepetitionLevels` copies from that 
buffer whenever it is not empty. `initLevelDecodersV1` leaves it populated when 
a new page starts, so the next page reads the previous page's levels. 
`initLevelDecodersV2` clears it.
   
   
https://github.com/apache/arrow-go/blob/be922ec557c08b06d9f8243023b08e192eaeaa1d/parquet/file/column_reader.go#L551-L561
   
   
https://github.com/apache/arrow-go/blob/be922ec557c08b06d9f8243023b08e192eaeaa1d/parquet/file/column_reader.go#L442-L472
   
   
https://github.com/apache/arrow-go/blob/be922ec557c08b06d9f8243023b08e192eaeaa1d/parquet/file/column_reader.go#L423-L428
   
   I have a patch with tests and can open a PR.
   
   ### Component(s)
   
   Parquet
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to