demetribu commented on issue #13237:
URL: https://github.com/apache/datafusion/issues/13237#issuecomment-2465328434

   ```
   #[test]
   fn test_batch_indices_overflow() -> Result<()> {
       use arrow_array::{Int64Array, ArrayRef, PrimitiveArray};
       use std::sync::Arc;
       
       let int_values: Vec<i64> = (1..=100000).collect();
       let int64_array = Int64Array::from(int_values);
   
       let mut list_builder = ListBuilder::new(Int64Array::builder(100000));
       list_builder.values().append_slice(int64_array.values());
       list_builder.append(true); // Mark this as a single list item in the 
ListArray
   
       let list_array = Arc::new(list_builder.finish()) as ArrayRef;
   
       let indices = Int64Array::from(vec![0i64; 100000]);
       let result = repeat_arrs_from_indices(&[list_array], &indices);    
       assert!(
           result.is_ok(),
           "Expected successful result with repeated indices, but got error: 
{:?}",
           result
       );
   
       Ok(())
   }
   ```    
       
   Failed with: 
   ```
   thread 'unnest::tests::test_batch_indices_overflow' panicked at 
.cargo/registry/src/index.crates.io-6f17d22bba15001f/arrow-select-53.2.0/src/take.rs:773:13:
 attempt to add with overflow
   ```
   
   
   ```
   #[test]
   fn test_batch_indices_overflow() -> Result<()> {
       use arrow::{array::{LargeListBuilder, ListBuilder}, datatypes::{Field, 
Int32Type}};
       use arrow_array::{Int64Array, ArrayRef, PrimitiveArray};
       use std::sync::Arc;
       
       let int_values: Vec<i64> = (1..=100000).collect();
       let int64_array = Int64Array::from(int_values);
   
       let mut list_builder = 
LargeListBuilder::new(Int64Array::builder(100000));
       list_builder.values().append_slice(int64_array.values());
       list_builder.append(true); // Mark this as a single list item in the 
ListArray
   
       let list_array = Arc::new(list_builder.finish()) as ArrayRef;
   
       let indices = Int64Array::from(vec![0i64; 100000]);
       let result = repeat_arrs_from_indices(&[list_array], &indices);    
       assert!(
           result.is_ok(),
           "Expected successful result with repeated indices, but got error: 
{:?}",
           result
       );
   
       Ok(())
   }
   ```
   
   It works, but slow, taking 224.24 seconds.
   
   cc @alamb 
       


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to