tschaub commented on issue #37402:
URL: https://github.com/apache/arrow/issues/37402#issuecomment-1694760534

   I see now that I might have misinterpreted a "record" as corresponding to a 
single row.  It looks like the test above passes if I increment the `numRows` 
by `rec.NumRows()` instead of by 1 (I was assuming each record represented a 
single row).
   
   ```diff
    func TestRecordReading(t *testing.T) {
           f, fileErr := os.Open("testdata/example.parquet")
           require.NoError(t, fileErr)
           reader, readerErr := file.NewParquetReader(f)
           require.NoError(t, readerErr)
           defer reader.Close()
    
   -       pqReader, pqErr := pqarrow.NewFileReader(reader, 
pqarrow.ArrowReadProperties{BatchSize: 1}, memory.DefaultAllocator)
   +       pqReader, pqErr := pqarrow.NewFileReader(reader, 
pqarrow.ArrowReadProperties{BatchSize: 10}, memory.DefaultAllocator)
           require.NoError(t, pqErr)
    
           recordReader, rrErr := 
pqReader.GetRecordReader(context.Background(), nil, nil)
           require.NoError(t, rrErr)
    
           numRows := 0
           for {
                   rec, err := recordReader.Read()
                   if err == io.EOF {
                           assert.Nil(t, rec)
                           break
                   }
                   assert.NoError(t, err)
   -               numRows += 1
   +               numRows += int(rec.NumRows())
           }
    
           assert.Equal(t, reader.NumRows(), int64(numRows))
    }
   ```
   
   I thought the batch size had to do with the size of a buffer used internally 
when reading column values, and didn't understand that it would determine the 
number of rows per record from a record reader.


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