hcrosse opened a new issue, #1522: URL: https://github.com/apache/arrow-go/issues/1522
### Describe the bug, including details regarding any error messages, version, and platform. `SeekToRow` on a repeated column with V1 pages and no offset index returns wrong rows without an error. I reproduced this on v18.8.0, with Go 1.27.3 on macOS arm64. An equivalent test gives the same result on v18.7.0. The code involved is unchanged on main. I wrote a nullable `list<int32>` column with 300 rows of three consecutive integers each, starting at `[0,1,2]`. I used `pqarrow.NewFileWriter` with V1 pages, dictionary encoding disabled, no page index, `WithDataPageSize(256)` and `WithBatchSize(16)`. I read it through `pqarrow.NewFileReader` and `GetRecordReader` with a batch size of 1024. I called `SeekToRow(150)` and read to the end. It returned 243 rows starting at `[195,196,197]` instead of 150 rows starting at `[450,451,452]`. With a page index or V2 pages, the rows are right. **Cause** `serializedPageReader.Next` adds a V1 page's `num_values` to `rowsSeen`, but that counts levels rather than rows for a repeated column. V2 uses `num_rows`. https://github.com/apache/arrow-go/blob/be922ec557c08b06d9f8243023b08e192eaeaa1d/parquet/file/page_reader.go#L1065-L1066 https://github.com/apache/arrow-go/blob/be922ec557c08b06d9f8243023b08e192eaeaa1d/parquet/file/page_reader.go#L1123-L1124 Without an offset index, `SeekToPageWithRow` scans until `rowsSeen` reaches the requested row, and `SeekToRow` uses `FirstRowIndex` to calculate the remaining rows to skip. Both calculations therefore use a level count as a row count. https://github.com/apache/arrow-go/blob/be922ec557c08b06d9f8243023b08e192eaeaa1d/parquet/file/page_reader.go#L875-L887 https://github.com/apache/arrow-go/blob/be922ec557c08b06d9f8243023b08e192eaeaa1d/parquet/file/column_reader.go#L614-L636 With the fix for #1521 applied, the same seek fails with `number of decoded rep/def levels did not match` instead of returning wrong rows. 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]
