alamb commented on code in PR #6475:
URL: https://github.com/apache/arrow-rs/pull/6475#discussion_r1779446685


##########
arrow-select/src/take.rs:
##########
@@ -94,6 +94,65 @@ pub fn take(
     }
 }
 
+/// For each [ArrayRef] in the [`Vec<ArrayRef>`], take elements by index and 
create a new
+/// [`Vec<ArrayRef>`] from those indices.
+///
+/// ```text
+/// ┌────────┬────────┐

Review Comment:
   ❤️ 



##########
arrow-select/src/take.rs:
##########
@@ -94,6 +94,65 @@ pub fn take(
     }
 }
 
+/// For each [ArrayRef] in the [`Vec<ArrayRef>`], take elements by index and 
create a new
+/// [`Vec<ArrayRef>`] from those indices.
+///
+/// ```text
+/// ┌────────┬────────┐
+/// │        │        │           ┌────────┐                                
┌────────┬────────┐
+/// │   A    │   1    │           │        │                                │  
      │        │
+/// ├────────┼────────┤           │   0    │                                │  
 A    │   1    │
+/// │        │        │           ├────────┤                                
├────────┼────────┤
+/// │   D    │   4    │           │        │                                │  
      │        │
+/// ├────────┼────────┤           │   2    │  take_arrays(values,indices)   │  
 B    │   2    │
+/// │        │        │           ├────────┤                                
├────────┼────────┤
+/// │   B    │   2    │           │        │  ───────────────────────────►  │  
      │        │
+/// ├────────┼────────┤           │   3    │                                │  
 C    │   3    │
+/// │        │        │           ├────────┤                                
├────────┼────────┤
+/// │   C    │   3    │           │        │                                │  
      │        │
+/// ├────────┼────────┤           │   1    │                                │  
 D    │   4    │
+/// │        │        │           └────────┘                                
└────────┼────────┘
+/// │   E    │   5    │
+/// └────────┴────────┘
+///    values arrays             indices array                                 
     result
+/// ```
+///
+/// # Errors
+/// This function errors whenever:
+/// * An index cannot be casted to `usize` (typically 32 bit architectures)
+/// * An index is out of bounds and `options` is set to check bounds.
+///
+/// # Safety
+///
+/// When `options` is not set to check bounds, taking indexes after `len` will 
panic.
+///
+/// # Examples
+/// ```
+/// # use std::sync::Arc;

Review Comment:
   👍  I think this example is good and also serves the case of test coverage. 
❤️ 



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