Veeupup commented on code in PR #8142:
URL: https://github.com/apache/arrow-datafusion/pull/8142#discussion_r1392569529
##########
datafusion/physical-expr/src/array_expressions.rs:
##########
@@ -563,13 +563,42 @@ pub fn array_slice(args: &[ArrayRef]) -> Result<ArrayRef>
{
define_array_slice(list_array, key, extra_key, false)
}
+fn general_array_pop(
+ list_array: &GenericListArray<i32>,
+ from_back: bool,
+) -> Result<(Vec<i64>, Vec<i64>)> {
+ if from_back {
+ let key = vec![0; list_array.len()];
+ let extra_key: Vec<_> = list_array
+ .iter()
+ .map(|x| x.map_or(0, |arr| arr.len() as i64 - 1))
+ .collect();
+ Ok((key, extra_key))
+ } else {
+ let key: Vec<_> = list_array.iter().map(|x| x.map_or(0, |_arr|
2)).collect();
Review Comment:
2 is the first element position (position = index + 1) we want in the new
array.
We only handle two cases of the first element index: if the old array has
any elements, starts from 2 (index + 1), or starts from initial.
--
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]