daniel-adam-tfs commented on code in PR #547:
URL: https://github.com/apache/arrow-go/pull/547#discussion_r2716463494


##########
parquet/file/column_reader_test.go:
##########
@@ -813,6 +826,145 @@ func TestFullSeekRow(t *testing.T) {
        }
 }
 
+func checkDecryptedValues(t *testing.T, writerProps *parquet.WriterProperties, 
readProps *parquet.ReaderProperties) {
+       sc := arrow.NewSchema([]arrow.Field{
+               {Name: "c0", Type: arrow.PrimitiveTypes.Int64, Nullable: true},
+               {Name: "c1", Type: arrow.BinaryTypes.String, Nullable: true},
+               {Name: "c2", Type: arrow.ListOf(arrow.PrimitiveTypes.Int64), 
Nullable: true},
+       }, nil)
+
+       tbl, err := array.TableFromJSON(mem, sc, []string{`[
+               {"c0": 1,    "c1": "a",  "c2": [1]},
+               {"c0": 2,    "c1": "b",  "c2": [1, 2]},
+               {"c0": 3,    "c1": "c",  "c2": [null]},
+               {"c0": null, "c1": "d",  "c2": []},
+               {"c0": 5,    "c1": null, "c2": [3, 3, 3]},
+               {"c0": 6,    "c1": "f",  "c2": null}
+       ]`})
+       require.NoError(t, err)
+       defer tbl.Release()
+
+       schema := tbl.Schema()
+       arrWriterProps := pqarrow.NewArrowWriterProperties()
+
+       var buf bytes.Buffer
+       wr, err := pqarrow.NewFileWriter(schema, &buf, writerProps, 
arrWriterProps)
+       require.NoError(t, err)
+
+       require.NoError(t, wr.WriteTable(tbl, tbl.NumRows()))
+       require.NoError(t, wr.Close())
+
+       rdr, err := file.NewParquetReader(bytes.NewReader(buf.Bytes()), 
file.WithReadProps(readProps))
+       require.NoError(t, err)
+       defer rdr.Close()
+
+       rgr := rdr.RowGroup(0)
+       col0, err := rgr.Column(0)
+       require.NoError(t, err)
+
+       icr := col0.(*file.Int64ColumnChunkReader)
+       // require.NoError(t, icr.SeekToRow(3)) // TODO: this causes a panic 
currently

Review Comment:
   This still panics:
   
   ```
   --- FAIL: TestDecryptColumns (0.00s)
       --- FAIL: TestDecryptColumns/DataPageV2_BufferedRead (0.00s)
   panic: cipher: message authentication failed [recovered, repanicked]
   
   goroutine 8 [running]:
   testing.tRunner.func1.2({0x2899940, 0xc000054100})
        /usr/local/Cellar/go/1.25.6/libexec/src/testing/testing.go:1872 +0x237
   testing.tRunner.func1()
        /usr/local/Cellar/go/1.25.6/libexec/src/testing/testing.go:1875 +0x35b
   panic({0x2899940?, 0xc000054100?})
        /usr/local/Cellar/go/1.25.6/libexec/src/runtime/panic.go:783 +0x132
   
github.com/apache/arrow-go/v18/parquet/internal/encryption.(*aesDecryptor).Decrypt(0xc0002c58f0,
 {0xc000026800, 0x4000, 0x4000}, {0xc0002c5b10?, 0x600c00003ff20?, 0x44d3560?}, 
{0xc0002c5e90, 0xd, 0x10})
        /daniel-adam-tfs/arrow-go/parquet/internal/encryption/aes.go:262 +0x26d
   
github.com/apache/arrow-go/v18/parquet/internal/encryption.(*decryptor).Decrypt(0xc0003326c0?,
 {0xc000026800?, 0xc00003fd40?, 0x1397b05?})
        /daniel-adam-tfs/arrow-go/parquet/internal/encryption/decryptor.go:268 
+0x45
   
github.com/apache/arrow-go/v18/parquet/file.(*serializedPageReader).readPageHeader(0xc0003326c0,
 {0x2aceb20, 0xc00003ff20}, 0xc0002ff740)
        /daniel-adam-tfs/arrow-go/parquet/file/page_reader.go:704 +0x139
   
github.com/apache/arrow-go/v18/parquet/file.(*serializedPageReader).Next(0xc0003326c0)
        /daniel-adam-tfs/arrow-go/parquet/file/page_reader.go:798 +0xdd
   
github.com/apache/arrow-go/v18/parquet/file.(*serializedPageReader).SeekToPageWithRow(0xc0003326c0,
 0x3)
        /daniel-adam-tfs/arrow-go/parquet/file/page_reader.go:749 +0x186
   
github.com/apache/arrow-go/v18/parquet/file.(*columnChunkReader).SeekToRow(0xc0002fa780,
 0x3)
        /daniel-adam-tfs/arrow-go/parquet/file/column_reader.go:584 +0x2a
   
github.com/apache/arrow-go/v18/parquet/file_test.checkDecryptedValues(0xc000326380,
 0xc000210870, 0xc0003283f0)
        /daniel-adam-tfs/arrow-go/parquet/file/column_reader_test.go:867 +0x591
   
github.com/apache/arrow-go/v18/parquet/file_test.TestDecryptColumns.func1(0xc000326380)
        /daniel-adam-tfs/arrow-go/parquet/file/column_reader_test.go:964 +0x18a
   testing.tRunner(0xc000326380, 0xc0002fe680)
        /usr/local/Cellar/go/1.25.6/libexec/src/testing/testing.go:1934 +0xea
   created by testing.(*T).Run in goroutine 7
        /usr/local/Cellar/go/1.25.6/libexec/src/testing/testing.go:1997 +0x465
   FAIL github.com/apache/arrow-go/v18/parquet/file     1.922s
   ```
   
   For each of the cases defined, doesn't matter whether it is a V1 or V2 page, 
or if is it compressed or not, or if BufferedStream is used or not. SeekToRow 
works in the unencrypted case, so this is again encryption related.



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