hcrosse commented on code in PR #1588:
URL: https://github.com/apache/arrow-go/pull/1588#discussion_r4591947429


##########
parquet/file/page_reader.go:
##########
@@ -737,17 +738,40 @@ func extractStats(dataHeader dataheader) (pageStats 
metadata.EncodedStatistics)
        return
 }
 
+// dictionaryAtDataOffset reports whether the page at data_page_offset may be a
+// dictionary page, which is so when the chunk records no dictionary offset or
+// the same offset as the data offset. Encrypted chunks are excluded because 
the
+// AAD of a page header depends on the page type, which is unknown before the
+// header is read.
+func (p *serializedPageReader) dictionaryAtDataOffset() bool {
+       return p.dataOffset <= p.baseOffset && p.cryptoCtx.MetaDecryptor == nil
+}
+
 func (p *serializedPageReader) GetDictionaryPage() (*DictionaryPage, error) {

Review Comment:
   With that ordering `GetDictionaryPage` now returns an error instead of 
panicking, and `TestGetDictionaryPageOffsetPastDataPageOffset` covers it. An 
error that names the offsets would be a separate change.



##########
parquet/pqarrow/file_reader_test.go:
##########
@@ -670,6 +670,44 @@ func TestRecordReaderSeekToRowMultiRowGroup(t *testing.T) {
        assert.Truef(t, array.RecordEqual(first, rec), "expected: %s\ngot: %s", 
first, rec)
 }
 
+// string_col in alltypes_tiny_pages is dictionary encoded and its chunk has no
+// dictionary_page_offset.
+func TestRecordReaderSeekToRowDictionaryAtDataPageOffset(t *testing.T) {
+       mem := memory.NewCheckedAllocator(memory.DefaultAllocator)
+       defer mem.AssertSize(t, 0)
+
+       pf, err := file.OpenParquetFile(path.Join(getDataDir(), 
"alltypes_tiny_pages.parquet"), false,

Review Comment:
   This follows the other tests in this file, which use `getDataDir()`.



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