Sunyue commented on issue #619:
URL: https://github.com/apache/arrow-go/issues/619#issuecomment-3701277102

   Reading from an os.File can also end in same error. Please find program to 
reproduce this issue below:
   
   ```go
   package main
   
   import (
        "context"
        "log"
        "os"
   
        "github.com/apache/arrow-go/v18/arrow/memory"
        "github.com/apache/arrow-go/v18/parquet"
        "github.com/apache/arrow-go/v18/parquet/file"
        "github.com/apache/arrow-go/v18/parquet/pqarrow"
   )
   
   func main() {
        pFile, err := os.Open("<path_to_file>")
        if err != nil {
                log.Fatal(err)
        }
   
        ctx := context.Background()
        opts := &parquet.ReaderProperties{
                BufferSize:            1024,
                FileDecryptProps:      nil,
                BufferedStreamEnabled: true,
        }
   
        base, err := file.NewParquetReader(pFile, file.WithReadProps(opts))
        if err != nil {
                log.Fatal(err)
        }
   
        pReader, err := pqarrow.NewFileReader(base, pqarrow.ArrowReadProperties{
                Parallel:  true,
                BatchSize: 3000,
        }, memory.DefaultAllocator)
        if err != nil {
                log.Fatal(err)
        }
   
        numOfRowGroups := pReader.ParquetReader().NumRowGroups()
   
        for rgIdx := range numOfRowGroups {
                rReader, err := pReader.GetRecordReader(ctx, nil, []int{rgIdx})
                if err != nil {
                        log.Fatal(err)
                }
   
                for rReader.Next() {
                        batch := rReader.RecordBatch()
                        log.Printf("got batch: %v records", batch.NumRows())
                }
        }
   }
   
   ```


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