mbutrovich opened a new issue, #11606:
URL: https://github.com/apache/arrow-rs/issues/11606

   ### Describe the bug
   
   The rustdoc of 
[`BatchCoalescer::is_empty`](https://github.com/apache/arrow-rs/blob/dd240116c75a15a2a048a041c808d67f3f32a375/arrow-select/src/coalesce.rs#L616-L619)
 says "Returns true if there is any buffered data". It returns 
`self.buffered_rows == 0 && self.completed.is_empty()`, which is true when 
there is no buffered data and no completed batch.
   
   ### To Reproduce
   
   ```rust
   use std::sync::Arc;
   use arrow_array::{Int32Array, RecordBatch};
   use arrow_schema::{DataType, Field, Schema};
   use arrow_select::coalesce::BatchCoalescer;
   
   fn main() {
       let schema = Arc::new(Schema::new(vec![Field::new("a", DataType::Int32, 
false)]));
       let mut co = BatchCoalescer::new(schema.clone(), 10);
       println!("{}", co.is_empty()); // true, with nothing buffered
       let batch = RecordBatch::try_new(schema, 
vec![Arc::new(Int32Array::from(vec![1, 2]))]).unwrap();
       co.push_batch(batch).unwrap();
       println!("{}", co.is_empty()); // false, with 2 rows buffered
   }
   ```
   
   ### Expected behavior
   
   A rustdoc that matches the behavior, such as "Returns true if there are no 
buffered rows and no completed batches".
   
   ### Additional context
   
   Found with property-based tests that build arrays in every physical layout 
the Arrow format allows, on `main` at `72887ed9`. The rustdoc is unchanged on 
`main` at `dd240116`.
   


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