hcrosse opened a new pull request, #1588:
URL: https://github.com/apache/arrow-go/pull/1588

   ### Rationale for this change
   
   `SeekToRow` fails when the dictionary page sits at `data_page_offset` and 
`dictionary_page_offset` is absent or equal to it. Unreleased parquet-mr 1.12.0 
snapshots and 1.12.0-rc0 between 
[PARQUET-1850](https://issues.apache.org/jira/browse/PARQUET-1850) and 
[PARQUET-1977](https://issues.apache.org/jira/browse/PARQUET-1977) wrote equal 
offsets.
   
   I reproduced this on v18.8.0 and main, with Go 1.26.10 on macOS arm64.
   
   ### What changes are included in this PR?
   
   When the dictionary page's length is unknown, `GetDictionaryPage` reads the 
chunk's first page, buffering only a header. Without a recorded offset, it 
ignores other page types.
   
   Without an offset index, seeking skips the dictionary page, which fixes 
`SeekToRow(0)` after a read.
   
   `GetDictionaryPage` returns an error instead of panicking on 
parquet-testing's `column_chunk_key_value_metadata.parquet`, whose 
`data_page_offset` precedes `dictionary_page_offset`.
   
   Encrypted chunks without a recorded dictionary offset are not probed, since 
a page header's AAD depends on its type.
   
   ### Are these changes tested?
   
   `TestSeekToRowDictionaryAtDataPageOffset`, 
`TestSeekToRowDictionaryPageOffsetEqualsDataPageOffset`, 
`TestGetDictionaryPageOffsetPastDataPageOffset`, 
`TestRecordReaderSeekToRowDictionaryAtDataPageOffset` and 
`TestGetDictionaryPageWithoutRecordedOffsetReadsOnlyTheDictionary` fail on main 
and pass with this change.
   
   `TestEncryptedChunkWithoutDictionaryIsNotProbed`, 
`TestSeekToRowZeroOnEncryptedChunkStartingWithDictionaryPage` and 
`TestGetDictionaryPageWithoutRecordedOffset` pass on main and guard unchanged 
behavior.
   
   Full `go test -race -tags assert,test ./parquet/...` and `golangci-lint` 
2.13.2 passed on linux/amd64 with pinned test data, and focused tests passed on 
macOS arm64.
   
   ### Are there any user-facing changes?
   
   Yes. `SeekToRow` finds dictionary pages at `data_page_offset`. There is no 
API change.
   
   Closes https://github.com/apache/arrow-go/issues/1566.
   


-- 
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