#[repr(C)]pub struct FFI_ArrowSchema { /* private fields */ }
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()
}
Implementations§
Source§impl FFI_ArrowSchema
impl FFI_ArrowSchema
Sourcepub fn try_new(
format: &str,
children: Vec<FFI_ArrowSchema>,
dictionary: Option<FFI_ArrowSchema>,
) -> Result<Self, ArrowError>
pub fn try_new( format: &str, children: Vec<FFI_ArrowSchema>, dictionary: Option<FFI_ArrowSchema>, ) -> Result<Self, ArrowError>
create a new FFI_ArrowSchema
. This fails if the fields’
DataType
is not supported.
Sourcepub fn with_name(self, name: &str) -> Result<Self, ArrowError>
pub fn with_name(self, name: &str) -> Result<Self, ArrowError>
Set the name of the schema
Sourcepub fn with_flags(self, flags: Flags) -> Result<Self, ArrowError>
pub fn with_flags(self, flags: Flags) -> Result<Self, ArrowError>
Set the flags of the schema
Sourcepub fn with_metadata<I, S>(self, metadata: I) -> Result<Self, ArrowError>
pub fn with_metadata<I, S>(self, metadata: I) -> Result<Self, ArrowError>
Add metadata to the schema
Sourcepub unsafe fn from_raw(schema: *mut FFI_ArrowSchema) -> Self
pub unsafe fn from_raw(schema: *mut FFI_ArrowSchema) -> Self
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
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Create an empty FFI_ArrowSchema
Sourcepub fn child(&self, index: usize) -> &Self
pub fn child(&self, index: usize) -> &Self
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.
Sourcepub fn children(&self) -> impl Iterator<Item = &Self>
pub fn children(&self) -> impl Iterator<Item = &Self>
Returns an iterator to the schema’s children.
Sourcepub fn nullable(&self) -> bool
pub fn nullable(&self) -> bool
Returns if the field is semantically nullable, regardless of whether it actually has null values.
Sourcepub fn dictionary(&self) -> Option<&Self>
pub fn dictionary(&self) -> Option<&Self>
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.
Sourcepub 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
Sourcepub 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.