diff --git a/arrow-schema/src/datatype.rs b/arrow-schema/src/datatype.rs index edd1dd09620e..4f8c8a18bd17 100644 --- a/arrow-schema/src/datatype.rs +++ b/arrow-schema/src/datatype.rs @@ -18,7 +18,7 @@ use std::fmt; use std::sync::Arc; -use crate::{FieldRef, Fields, UnionFields}; +use crate::{Field, FieldRef, Fields, UnionFields}; /// The set of datatypes that are supported by this implementation of Apache Arrow. /// @@ -576,6 +576,11 @@ impl DataType { _ => self == other, } } + + /// Create a List DataType default name is "item" + pub fn new_list(data_type: DataType, nullable: bool) -> Self { + DataType::List(Arc::new(Field::new("item", data_type, nullable))) + } } /// The maximum precision for [DataType::Decimal128] values