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

   **Describe the bug**
   <!--
   A clear and concise description of what the bug is.
   -->
   
   The `Row` is no longer comparable when the `Rows` get reused after 
`Rows::clear()`.
   
   **To Reproduce**
   <!--
   Steps to reproduce the behavior:
   -->
   
   ```rs
       #[test]
       fn test_clear() {
           let mut converter =
               
RowConverter::new(vec![SortField::new(DataType::Int32)]).unwrap();
           let mut rows = converter.empty_rows(3, 128);
   
           let first = Int32Array::from(vec![None, Some(2), Some(4)]);
           let second = Int32Array::from(vec![Some(2), None, Some(4)]);
   
           let arrays = vec![
               Arc::new(first) as ArrayRef,
               Arc::new(second) as ArrayRef
           ];
   
           for array in arrays.iter() {
               rows.clear();
               converter.append(&mut rows, &[array.clone()]).unwrap();
               let back = converter.convert_rows(&rows).unwrap();
               assert_eq!(&back[0], array);
           }
   
           let mut rows_expected = converter.empty_rows(3, 128);
           converter.append(&mut rows_expected, &arrays[1..]).unwrap();
   
           for (i, (actual, expected)) in 
rows.iter().zip(rows_expected.iter()).enumerate() {
               assert_eq!(actual, expected, "For row {}: expected {:?}, actual: 
{:?}", i, expected, actual);
           }
       }
   ```
   
   The test fails with:
   
   ```
   For row 1: expected Row { data: [0, 0, 0, 0, 0], config: RowConfig { fields: 
[SortField { options: SortOptions { descending: false, nulls_first: true }, 
data_type: Int32, preserve_dictionaries: true }], validate_utf8: false } }, 
actual: Row { data: [0, 128, 0, 0, 2], config: RowConfig { fields: [SortField { 
options: SortOptions { descending: false, nulls_first: true }, data_type: 
Int32, preserve_dictionaries: true }], validate_utf8: false } }
   
   ```
   
   **Expected behavior**
   <!--
   A clear and concise description of what you expected to happen.
   -->
   
   Pass the test.
   
   **Additional context**
   <!--
   Add any other context about the problem here.
   -->
   
   Encontered this while working on 
https://github.com/apache/arrow-datafusion/pull/7426


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