izveigor commented on code in PR #6805:
URL: https://github.com/apache/arrow-datafusion/pull/6805#discussion_r1250871073
##########
datafusion/physical-expr/src/array_expressions.rs:
##########
@@ -243,20 +281,58 @@ pub fn array_append(args: &[ArrayRef]) ->
Result<ArrayRef> {
}
};
- Ok(array(scalars.as_slice())?.into_array(1))
+ Ok(res)
}
macro_rules! prepend {
($ARRAY:expr, $ELEMENT:expr, $ARRAY_TYPE:ident) => {{
- let child_array =
- downcast_arg!(downcast_arg!($ARRAY, ListArray).values(),
$ARRAY_TYPE);
+ let mut offsets: Vec<i32> = vec![0];
+ let mut values =
+ downcast_arg!(new_empty_array($ELEMENT.data_type()),
$ARRAY_TYPE).clone();
+
let element = downcast_arg!($ELEMENT, $ARRAY_TYPE);
- let cat = compute::concat(&[element, child_array])?;
- let mut scalars = vec![];
- for i in 0..cat.len() {
-
scalars.push(ColumnarValue::Scalar(ScalarValue::try_from_array(&cat, i)?));
+ for (arr, el) in $ARRAY.iter().zip(element.iter()) {
+ let last_offset: i32 = offsets.last().copied().ok_or_else(|| {
+ DataFusionError::Internal(format!("offsets should not be
empty",))
+ })?;
+ match arr {
+ Some(arr) => {
+ let child_array = downcast_arg!(arr, $ARRAY_TYPE);
+ values = downcast_arg!(
+ compute::concat(&[
Review Comment:
`arrow-rs` does not support `into_builder` method for `GenericListArray`. Is
the `concat` method better than `builder`. Or is there a great third option? 🤔
--
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]