Trait arrow::array::Array [−][src]
pub trait Array: Debug + Send + Sync + JsonEqual {}Show methods
fn as_any(&self) -> &dyn Any; fn data(&self) -> &ArrayData; fn get_buffer_memory_size(&self) -> usize; fn get_array_memory_size(&self) -> usize; fn data_ref(&self) -> &ArrayData { ... } fn data_type(&self) -> &DataType { ... } fn slice(&self, offset: usize, length: usize) -> ArrayRef { ... } fn len(&self) -> usize { ... } fn is_empty(&self) -> bool { ... } fn offset(&self) -> usize { ... } fn is_null(&self, index: usize) -> bool { ... } fn is_valid(&self, index: usize) -> bool { ... } fn null_count(&self) -> usize { ... } fn to_raw(&self) -> Result<(*const FFI_ArrowArray, *const FFI_ArrowSchema)> { ... }
Expand description
Trait for dealing with different types of array at runtime when the type of the array is not known in advance.
Required methods
fn as_any(&self) -> &dyn Any
[src]
fn as_any(&self) -> &dyn Any
[src]Returns the array as Any
so that it can be
downcasted to a specific implementation.
Example:
use std::sync::Arc; use arrow::array::Int32Array; use arrow::datatypes::{Schema, Field, DataType}; use arrow::record_batch::RecordBatch; let id = Int32Array::from(vec![1, 2, 3, 4, 5]); let batch = RecordBatch::try_new( Arc::new(Schema::new(vec![Field::new("id", DataType::Int32, false)])), vec![Arc::new(id)] )?; let int32array = batch .column(0) .as_any() .downcast_ref::<Int32Array>() .expect("Failed to downcast");
fn data(&self) -> &ArrayData
[src]
fn data(&self) -> &ArrayData
[src]Returns a reference to the underlying data of this array.
fn get_buffer_memory_size(&self) -> usize
[src]
fn get_buffer_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied by the buffers owned by this array.
fn get_array_memory_size(&self) -> usize
[src]
fn get_array_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied physically by this array.
Provided methods
fn data_ref(&self) -> &ArrayData
[src]
fn data_ref(&self) -> &ArrayData
[src]Returns a reference-counted pointer to the underlying data of this array.
fn data_type(&self) -> &DataType
[src]
fn data_type(&self) -> &DataType
[src]Returns a reference to the DataType
of this array.
Example:
use arrow::datatypes::DataType; use arrow::array::{Array, Int32Array}; let array = Int32Array::from(vec![1, 2, 3, 4, 5]); assert_eq!(*array.data_type(), DataType::Int32);
fn slice(&self, offset: usize, length: usize) -> ArrayRef
[src]
fn slice(&self, offset: usize, length: usize) -> ArrayRef
[src]Returns a zero-copy slice of this array with the indicated offset and length.
Example:
use arrow::array::{Array, Int32Array}; let array = Int32Array::from(vec![1, 2, 3, 4, 5]); // Make slice over the values [2, 3, 4] let array_slice = array.slice(1, 3); assert_eq!(array_slice.as_ref(), &Int32Array::from(vec![2, 3, 4]));
fn len(&self) -> usize
[src]
fn len(&self) -> usize
[src]Returns the length (i.e., number of elements) of this array.
Example:
use arrow::array::{Array, Int32Array}; let array = Int32Array::from(vec![1, 2, 3, 4, 5]); assert_eq!(array.len(), 5);
fn is_empty(&self) -> bool
[src]
fn is_empty(&self) -> bool
[src]Returns whether this array is empty.
Example:
use arrow::array::{Array, Int32Array}; let array = Int32Array::from(vec![1, 2, 3, 4, 5]); assert_eq!(array.is_empty(), false);
fn offset(&self) -> usize
[src]
fn offset(&self) -> usize
[src]Returns the offset into the underlying data used by this array(-slice).
Note that the underlying data can be shared by many arrays.
This defaults to 0
.
Example:
use arrow::array::{Array, Int32Array}; let array = Int32Array::from(vec![1, 2, 3, 4, 5]); // Make slice over the values [2, 3, 4] let array_slice = array.slice(1, 3); assert_eq!(array.offset(), 0); assert_eq!(array_slice.offset(), 1);
fn is_null(&self, index: usize) -> bool
[src]
fn is_null(&self, index: usize) -> bool
[src]Returns whether the element at index
is null.
When using this function on a slice, the index is relative to the slice.
Example:
use arrow::array::{Array, Int32Array}; let array = Int32Array::from(vec![Some(1), None]); assert_eq!(array.is_null(0), false); assert_eq!(array.is_null(1), true);
fn is_valid(&self, index: usize) -> bool
[src]
fn is_valid(&self, index: usize) -> bool
[src]Returns whether the element at index
is not null.
When using this function on a slice, the index is relative to the slice.
Example:
use arrow::array::{Array, Int32Array}; let array = Int32Array::from(vec![Some(1), None]); assert_eq!(array.is_valid(0), true); assert_eq!(array.is_valid(1), false);
fn null_count(&self) -> usize
[src]
fn null_count(&self) -> usize
[src]Returns the total number of null values in this array.
Example:
use arrow::array::{Array, Int32Array}; // Construct an array with values [1, NULL, NULL] let array = Int32Array::from(vec![Some(1), None, None]); assert_eq!(array.null_count(), 2);
fn to_raw(&self) -> Result<(*const FFI_ArrowArray, *const FFI_ArrowSchema)>
[src]
fn to_raw(&self) -> Result<(*const FFI_ArrowArray, *const FFI_ArrowSchema)>
[src]returns two pointers that represent this array in the C Data Interface (FFI)
Trait Implementations
Implementors
impl Array for BooleanArray
[src]
impl Array for BooleanArray
[src]fn get_buffer_memory_size(&self) -> usize
[src]
fn get_buffer_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied by the buffers owned by this BooleanArray.
fn get_array_memory_size(&self) -> usize
[src]
fn get_array_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied physically by this BooleanArray.
impl Array for DecimalArray
[src]
impl Array for DecimalArray
[src]fn get_buffer_memory_size(&self) -> usize
[src]
fn get_buffer_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied by the buffers owned by this DecimalArray.
fn get_array_memory_size(&self) -> usize
[src]
fn get_array_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied physically by this DecimalArray.
impl Array for FixedSizeBinaryArray
[src]
impl Array for FixedSizeBinaryArray
[src]fn get_buffer_memory_size(&self) -> usize
[src]
fn get_buffer_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied by the buffers owned by this FixedSizeBinaryArray.
fn get_array_memory_size(&self) -> usize
[src]
fn get_array_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied physically by this FixedSizeBinaryArray.
impl Array for FixedSizeListArray
[src]
impl Array for FixedSizeListArray
[src]fn get_buffer_memory_size(&self) -> usize
[src]
fn get_buffer_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied by the buffers owned by this FixedSizeListArray.
fn get_array_memory_size(&self) -> usize
[src]
fn get_array_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied physically by this FixedSizeListArray.
impl Array for NullArray
[src]
impl Array for NullArray
[src]fn is_null(&self, _index: usize) -> bool
[src]
fn is_null(&self, _index: usize) -> bool
[src]Returns whether the element at index
is null.
All elements of a NullArray
are always null.
fn is_valid(&self, _index: usize) -> bool
[src]
fn is_valid(&self, _index: usize) -> bool
[src]Returns whether the element at index
is valid.
All elements of a NullArray
are always invalid.
fn null_count(&self) -> usize
[src]
fn null_count(&self) -> usize
[src]Returns the total number of null values in this array.
The null count of a NullArray
always equals its length.
fn get_buffer_memory_size(&self) -> usize
[src]
fn get_buffer_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied by the buffers owned by this NullArray.
fn get_array_memory_size(&self) -> usize
[src]
fn get_array_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied physically by this NullArray.
impl Array for StructArray
[src]
impl Array for StructArray
[src]fn get_buffer_memory_size(&self) -> usize
[src]
fn get_buffer_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied by the buffers owned by this StructArray.
fn get_array_memory_size(&self) -> usize
[src]
fn get_array_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied physically by this StructArray.
impl Array for UnionArray
[src]
impl Array for UnionArray
[src]fn get_buffer_memory_size(&self) -> usize
[src]
fn get_buffer_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied by the buffers owned by this UnionArray.
fn get_array_memory_size(&self) -> usize
[src]
fn get_array_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied physically by this UnionArray.
impl<OffsetSize: 'static + OffsetSizeTrait> Array for GenericListArray<OffsetSize>
[src]
impl<OffsetSize: 'static + OffsetSizeTrait> Array for GenericListArray<OffsetSize>
[src]fn get_buffer_memory_size(&self) -> usize
[src]
fn get_buffer_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied by the buffers owned by this ListArray.
fn get_array_memory_size(&self) -> usize
[src]
fn get_array_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied physically by this ListArray.
impl<OffsetSize: BinaryOffsetSizeTrait> Array for GenericBinaryArray<OffsetSize>
[src]
impl<OffsetSize: BinaryOffsetSizeTrait> Array for GenericBinaryArray<OffsetSize>
[src]fn get_buffer_memory_size(&self) -> usize
[src]
fn get_buffer_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied by the buffers owned by this [$name].
fn get_array_memory_size(&self) -> usize
[src]
fn get_array_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied physically by this [$name].
impl<OffsetSize: StringOffsetSizeTrait> Array for GenericStringArray<OffsetSize>
[src]
impl<OffsetSize: StringOffsetSizeTrait> Array for GenericStringArray<OffsetSize>
[src]fn get_buffer_memory_size(&self) -> usize
[src]
fn get_buffer_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied by the buffers owned by this [$name].
fn get_array_memory_size(&self) -> usize
[src]
fn get_array_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied physically by this [$name].
impl<T: ArrowPrimitiveType> Array for DictionaryArray<T>
[src]
impl<T: ArrowPrimitiveType> Array for DictionaryArray<T>
[src]impl<T: ArrowPrimitiveType> Array for PrimitiveArray<T>
[src]
impl<T: ArrowPrimitiveType> Array for PrimitiveArray<T>
[src]fn get_buffer_memory_size(&self) -> usize
[src]
fn get_buffer_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied by the buffers owned by this PrimitiveArray.
fn get_array_memory_size(&self) -> usize
[src]
fn get_array_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied physically by this PrimitiveArray.