pub struct Field { /* private fields */ }
Expand description
Implementations§
source§impl Field
impl Field
sourcepub fn new(name: impl Into<String>, data_type: DataType, nullable: bool) -> Field
pub fn new(name: impl Into<String>, data_type: DataType, nullable: bool) -> Field
Creates a new field
sourcepub fn new_dict(
name: impl Into<String>,
data_type: DataType,
nullable: bool,
dict_id: i64,
dict_is_ordered: bool
) -> Field
pub fn new_dict(
name: impl Into<String>,
data_type: DataType,
nullable: bool,
dict_id: i64,
dict_is_ordered: bool
) -> Field
Creates a new field that has additional dictionary information
sourcepub fn set_metadata(&mut self, metadata: HashMap<String, String, RandomState>)
pub fn set_metadata(&mut self, metadata: HashMap<String, String, RandomState>)
Sets the Field
’s optional custom metadata.
The metadata is set as None
for empty map.
sourcepub fn with_metadata(
self,
metadata: HashMap<String, String, RandomState>
) -> Field
pub fn with_metadata(
self,
metadata: HashMap<String, String, RandomState>
) -> Field
Sets the metadata of this Field
to be metadata
and returns self
sourcepub const fn metadata(&self) -> &HashMap<String, String, RandomState>
pub const fn metadata(&self) -> &HashMap<String, String, RandomState>
Returns the immutable reference to the Field
’s optional custom metadata.
sourcepub fn with_name(self, name: impl Into<String>) -> Field
pub fn with_name(self, name: impl Into<String>) -> Field
Set the name of the Field
and returns self.
let field = Field::new("c1", DataType::Int64, false)
.with_name("c2");
assert_eq!(field.name(), "c2");
sourcepub fn with_data_type(self, data_type: DataType) -> Field
pub fn with_data_type(self, data_type: DataType) -> Field
sourcepub const fn is_nullable(&self) -> bool
pub const fn is_nullable(&self) -> bool
Indicates whether this Field
supports null values.
sourcepub fn with_nullable(self, nullable: bool) -> Field
pub fn with_nullable(self, nullable: bool) -> Field
Set nullable
of the Field
and returns self.
let field = Field::new("c1", DataType::Int64, false)
.with_nullable(true);
assert_eq!(field.is_nullable(), true);
sourcepub const fn dict_id(&self) -> Option<i64>
pub const fn dict_id(&self) -> Option<i64>
Returns the dictionary ID, if this is a dictionary type.
sourcepub const fn dict_is_ordered(&self) -> Option<bool>
pub const fn dict_is_ordered(&self) -> Option<bool>
Returns whether this Field
’s dictionary is ordered, if this is a dictionary type.
sourcepub fn try_merge(&mut self, from: &Field) -> Result<(), ArrowError>
pub fn try_merge(&mut self, from: &Field) -> Result<(), ArrowError>
Merge this field into self if it is compatible.
Struct fields are merged recursively.
NOTE: self
may be updated to a partial / unexpected state in case of merge failure.
Example:
let mut field = Field::new("c1", DataType::Int64, false);
assert!(field.try_merge(&Field::new("c1", DataType::Int64, true)).is_ok());
assert!(field.is_nullable());
Trait Implementations§
source§impl Ord for Field
impl Ord for Field
source§impl PartialOrd<Field> for Field
impl PartialOrd<Field> for Field
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl PyArrowConvert for Field
impl PyArrowConvert for Field
source§impl TryFrom<&FFI_ArrowSchema> for Field
impl TryFrom<&FFI_ArrowSchema> for Field
§type Error = ArrowError
type Error = ArrowError
The type returned in the event of a conversion error.
source§fn try_from(c_schema: &FFI_ArrowSchema) -> Result<Self>
fn try_from(c_schema: &FFI_ArrowSchema) -> Result<Self>
Performs the conversion.
source§impl TryFrom<&Field> for FFI_ArrowSchema
impl TryFrom<&Field> for FFI_ArrowSchema
source§impl TryFrom<Field> for FFI_ArrowSchema
impl TryFrom<Field> for FFI_ArrowSchema
impl Eq for Field
Auto Trait Implementations§
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnwindSafe for Field
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.