Struct FFI_ArrowSchema
#[repr(C)]pub struct FFI_ArrowSchema {
format: *const i8,
name: *const i8,
metadata: *const i8,
flags: i64,
n_children: i64,
children: *mut *mut FFI_ArrowSchema,
dictionary: *mut FFI_ArrowSchema,
release: Option<unsafe extern "C" fn(_: *mut FFI_ArrowSchema)>,
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#structure-definitions
fn array_schema(data_type: &DataType) -> FFI_ArrowSchema {
FFI_ArrowSchema::try_from(data_type).unwrap()
}
Fields§
§format: *const i8
§name: *const i8
§metadata: *const i8
§flags: i64
§n_children: i64
§children: *mut *mut FFI_ArrowSchema
§dictionary: *mut FFI_ArrowSchema
§release: Option<unsafe extern "C" fn(_: *mut FFI_ArrowSchema)>
§private_data: *mut c_void
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
schema
must be valid for reads and writesschema
must be properly alignedschema
must 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.