Struct FFI_ArrowSchema
#[repr(C)]pub struct FFI_ArrowSchema {
pub format: *const i8,
pub name: *const i8,
pub metadata: *const i8,
pub flags: i64,
pub n_children: i64,
pub children: *mut *mut FFI_ArrowSchema,
pub dictionary: *mut FFI_ArrowSchema,
pub release: Option<unsafe extern "C" fn(*mut FFI_ArrowSchema)>,
pub private_data: *mut c_void,
}Expand description
ABI-compatible struct for ArrowSchema from C Data Interface
See https://arrow.apache.org/docs/format/CDataInterface.html#the-arrowschema-structure
fn array_schema(data_type: &DataType) -> FFI_ArrowSchema {
FFI_ArrowSchema::try_from(data_type).unwrap()
}Fields§
§format: *const i8Null-terminated, UTF8-encoded string describing the data type
name: *const i8Null-terminated, UTF8-encoded string of the field or array name
metadata: *const i8Binary string describing the type’s metadata
flags: i64A bitfield of flags enriching the type description Refer to Arrow Flags
n_children: i64The number of children this type has
children: *mut *mut FFI_ArrowSchemaC array of pointers to each child type of this type
dictionary: *mut FFI_ArrowSchemaPointer to the type of dictionary values
release: Option<unsafe extern "C" fn(*mut FFI_ArrowSchema)>Pointer to a producer-provided release callback
private_data: *mut c_voidOpaque pointer to producer-provided private data
Implementations§
§impl FFI_ArrowSchema
impl FFI_ArrowSchema
pub fn try_new(
format: &str,
children: Vec<FFI_ArrowSchema>,
dictionary: Option<FFI_ArrowSchema>,
) -> Result<FFI_ArrowSchema, ArrowError>
pub fn try_new( format: &str, children: Vec<FFI_ArrowSchema>, dictionary: Option<FFI_ArrowSchema>, ) -> Result<FFI_ArrowSchema, ArrowError>
create a new FFI_ArrowSchema. This fails if the fields’
DataType is not supported.
pub fn with_name(self, name: &str) -> Result<FFI_ArrowSchema, ArrowError>
pub fn with_name(self, name: &str) -> Result<FFI_ArrowSchema, ArrowError>
Set the name of the schema
pub fn with_flags(self, flags: Flags) -> Result<FFI_ArrowSchema, ArrowError>
pub fn with_flags(self, flags: Flags) -> Result<FFI_ArrowSchema, ArrowError>
Set the flags of the schema
pub fn with_metadata<I, S>(
self,
metadata: I,
) -> Result<FFI_ArrowSchema, ArrowError>
pub fn with_metadata<I, S>( self, metadata: I, ) -> Result<FFI_ArrowSchema, ArrowError>
Add metadata to the schema
pub unsafe fn from_raw(schema: *mut FFI_ArrowSchema) -> FFI_ArrowSchema
pub unsafe fn from_raw(schema: *mut FFI_ArrowSchema) -> FFI_ArrowSchema
Takes ownership of the pointed to FFI_ArrowSchema
This acts to move the data out of schema, setting the release callback to NULL
§Safety
schemamust be valid for reads and writesschemamust be properly alignedschemamust point to a properly initialized value ofFFI_ArrowSchema
pub fn empty() -> FFI_ArrowSchema
pub fn empty() -> FFI_ArrowSchema
Create an empty FFI_ArrowSchema
pub fn child(&self, index: usize) -> &FFI_ArrowSchema
pub fn child(&self, index: usize) -> &FFI_ArrowSchema
Returns the child of this schema at index.
§Panics
Panics if index is greater than or equal to the number of children.
This is to make sure that the unsafe acces to raw pointer is sound.
pub fn children(&self) -> impl Iterator<Item = &FFI_ArrowSchema>
pub fn children(&self) -> impl Iterator<Item = &FFI_ArrowSchema>
Returns an iterator to the schema’s children.
pub fn nullable(&self) -> bool
pub fn nullable(&self) -> bool
Returns if the field is semantically nullable, regardless of whether it actually has null values.
pub fn dictionary(&self) -> Option<&FFI_ArrowSchema>
pub fn dictionary(&self) -> Option<&FFI_ArrowSchema>
Returns the reference to the underlying dictionary of the schema. Check ArrowSchema.dictionary.
This must be Some if the schema represents a dictionary-encoded type, None otherwise.
pub fn map_keys_sorted(&self) -> bool
pub fn map_keys_sorted(&self) -> bool
For map types, returns whether the keys within each map value are sorted.
Refer to Arrow Flags
pub fn dictionary_ordered(&self) -> bool
pub fn dictionary_ordered(&self) -> bool
For dictionary-encoded types, returns whether the ordering of dictionary indices is semantically meaningful.