pub struct StructType { /* private fields */ }
Expand description
Representation of a Spark StructType
Used to create the a schema with other DataType
§Example:
let schema = StructType::new(vec![
StructField {
name: "name",
data_type: DataType::String,
nullable: false,
metadata: None,
},
StructField {
name: "age",
data_type: DataType::Short,
nullable: true,
metadata: None,
},
]);
Complex types are also supported. The example below creates an DataType::Array that contains a two StructField.
§Example:
let complex_schema = DataType::Array {
element_type: Box::new(DataType::Struct(Box::new(StructType::new(vec![
StructField {
name: "col5",
data_type: DataType::String,
nullable: true,
metadata: None,
},
StructField {
name: "col6",
data_type: DataType::Char(200),
nullable: true,
metadata: None,
},
])))),
contains_null: true,
};
Implementations§
Source§impl StructType
impl StructType
Sourcepub fn new(fields: Vec<StructField>) -> Self
pub fn new(fields: Vec<StructField>) -> Self
Create a new StructType from a vector of StructField
pub fn fields(&self) -> Vec<StructField>
Sourcepub fn append(self, field: StructField) -> Self
pub fn append(self, field: StructField) -> Self
Append a new field onto the exist fields
Trait Implementations§
Source§impl Clone for StructType
impl Clone for StructType
Source§fn clone(&self) -> StructType
fn clone(&self) -> StructType
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for StructType
impl Debug for StructType
Source§impl From<StructType> for DataType
impl From<StructType> for DataType
Source§fn from(value: StructType) -> DataType
fn from(value: StructType) -> DataType
Converts to this type from the input type.
Source§impl SparkDataType for StructType
impl SparkDataType for StructType
Auto Trait Implementations§
impl Freeze for StructType
impl RefUnwindSafe for StructType
impl Send for StructType
impl Sync for StructType
impl Unpin for StructType
impl UnwindSafe for StructType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request