generic_append_and_prepend

Function generic_append_and_prepend 

Source
fn generic_append_and_prepend<O: OffsetSizeTrait>(
    list_array: &GenericListArray<O>,
    element_array: &ArrayRef,
    data_type: &DataType,
    is_append: bool,
) -> Result<ArrayRef>
where i64: TryInto<O>,
Expand description

Appends or prepends elements to a ListArray.

This function takes a ListArray, an ArrayRef, a FieldRef, and a boolean flag indicating whether to append or prepend the elements. It returns a Result<ArrayRef> representing the resulting ListArray after the operation.

§Arguments

  • list_array - A reference to the ListArray to which elements will be appended/prepended.
  • element_array - A reference to the Array containing elements to be appended/prepended.
  • field - A reference to the Field describing the data type of the arrays.
  • is_append - A boolean flag indicating whether to append (true) or prepend (false) elements.

§Examples

generic_append_and_prepend( [1, 2, 3], 4, append => [1, 2, 3, 4] 5, [6, 7, 8], prepend => [5, 6, 7, 8] )