hcrosse opened a new issue, #1566:
URL: https://github.com/apache/arrow-go/issues/1566
### Describe the bug, including details regarding any error messages,
version, and platform.
`SeekToRow` fails on valid dictionary encoded files when a column chunk has
no `dictionary_page_offset` and its dictionary page starts at
`data_page_offset`.
I reproduced this on v18.8.0 and main, with Go 1.26.10 on macOS arm64.
This affects `file.ColumnChunkReader`, `file.RecordReader` and `pqarrow`'s
`RecordReader`. For a fresh reader of an affected dictionary column:
- Without an offset index, row 0 works and every row from 1 onward fails.
- With an offset index, every row fails, including row 0.
Reading the same columns sequentially works.
Affected files in `parquet-testing` include `alltypes_tiny_pages.parquet`,
`nullable.impala.parquet`, `nested_lists.snappy.parquet`,
`nested_maps.snappy.parquet` and `datapage_v2.snappy.parquet`. pyarrow 26.0.1
reads these files successfully.
**Key calls and results**
For column 2 (`tinyint_col`) of `alltypes_tiny_pages.parquet`:
```go
rdr, _ :=
file.OpenParquetFile("parquet-testing/data/alltypes_tiny_pages.parquet", false)
col, _ := rdr.RowGroup(0).Column(2)
err := col.SeekToRow(0)
```
Both versions return:
```text
parquet: dictionary page must be before data page
```
Expected: seeking succeeds because the dictionary page is present before the
data pages.
**Cause**
`init` records a dictionary offset only when the footer sets a positive
`dictionary_page_offset`. Without an offset index, `SeekToPageWithRow` reads
past the dictionary page for rows after 0. With an offset index, it jumps over
the dictionary page. The column reader then asks `GetDictionaryPage` for the
dictionary, which returns nothing when no offset was recorded, so the first
dictionary encoded data page fails.
https://github.com/apache/arrow-go/blob/fc5d5ce5a99b8583448b2cb70d0e9357dd10a420/parquet/file/page_reader.go#L482-L487
https://github.com/apache/arrow-go/blob/fc5d5ce5a99b8583448b2cb70d0e9357dd10a420/parquet/file/page_reader.go#L875-L886
https://github.com/apache/arrow-go/blob/fc5d5ce5a99b8583448b2cb70d0e9357dd10a420/parquet/file/page_reader.go#L890-L905
https://github.com/apache/arrow-go/blob/fc5d5ce5a99b8583448b2cb70d0e9357dd10a420/parquet/file/page_reader.go#L740-L794
https://github.com/apache/arrow-go/blob/fc5d5ce5a99b8583448b2cb70d0e9357dd10a420/parquet/file/column_reader.go#L481-L488
https://github.com/apache/arrow-go/blob/fc5d5ce5a99b8583448b2cb70d0e9357dd10a420/parquet/file/column_reader.go#L514-L515
I can open a PR for this.
### 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]