alamb commented on code in PR #7239:
URL: https://github.com/apache/arrow-datafusion/pull/7239#discussion_r1288928890
##########
datafusion/physical-expr/src/array_expressions.rs:
##########
@@ -1738,6 +1738,53 @@ pub fn cardinality(args: &[ArrayRef]) ->
Result<ArrayRef> {
Ok(Arc::new(result) as ArrayRef)
}
+// Create new offsets that are euqiavlent to `flatten` the array.
+fn get_offsets_for_flatten(
+ offsets: OffsetBuffer<i32>,
+ indexes: OffsetBuffer<i32>,
+) -> OffsetBuffer<i32> {
+ let buffer = offsets.into_inner();
+ let offsets: Vec<i32> = indexes.iter().map(|i| buffer[*i as
usize]).collect();
Review Comment:
This is a very nice implementation 👌
##########
datafusion/physical-expr/src/array_expressions.rs:
##########
@@ -1738,6 +1738,53 @@ pub fn cardinality(args: &[ArrayRef]) ->
Result<ArrayRef> {
Ok(Arc::new(result) as ArrayRef)
}
+// Create new offsets that are euqiavlent to `flatten` the array.
+fn get_offsets_for_flatten(
+ offsets: OffsetBuffer<i32>,
+ indexes: OffsetBuffer<i32>,
+) -> OffsetBuffer<i32> {
+ let buffer = offsets.into_inner();
+ let offsets: Vec<i32> = indexes.iter().map(|i| buffer[*i as
usize]).collect();
Review Comment:
This is a very nice implementation 👌
--
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]