pub fn create_batch_empty(schema: &Schema) -> ArrowResult<RecordBatch> {
    let columns = schema
        .fields()
        .iter()
        .map(|f| match f.data_type() {
            DataType::Float32 => {
                Ok(Arc::new(Float32Array::from(vec![] as Vec<f32>)) as ArrayRef)
            }
            DataType::Float64 => {
                Ok(Arc::new(Float64Array::from(vec![] as Vec<f64>)) as ArrayRef)
            }
            DataType::Int64 => {
                Ok(Arc::new(Int64Array::from(vec![] as Vec<i64>)) as ArrayRef)
            }
            DataType::Int32 => {
                Ok(Arc::new(Int32Array::from(vec![] as Vec<i32>)) as ArrayRef)
            }
            DataType::Int16 => {
                Ok(Arc::new(Int16Array::from(vec![] as Vec<i16>)) as ArrayRef)
            }
            DataType::Int8 => {
                Ok(Arc::new(Int8Array::from(vec![] as Vec<i8>)) as ArrayRef)
            }
            DataType::UInt64 => {
                Ok(Arc::new(UInt64Array::from(vec![] as Vec<u64>)) as ArrayRef)
            }
            DataType::UInt32 => {
                Ok(Arc::new(UInt32Array::from(vec![] as Vec<u32>)) as ArrayRef)
            }
            DataType::UInt16 => {
                Ok(Arc::new(UInt16Array::from(vec![] as Vec<u16>)) as ArrayRef)
            }
            DataType::UInt8 => {
                Ok(Arc::new(UInt8Array::from(vec![] as Vec<u8>)) as ArrayRef)
            }
            DataType::Utf8 => {
                Ok(Arc::new(StringArray::from(vec![] as Vec<&str>)) as ArrayRef)
            }
            DataType::LargeUtf8 => {
                Ok(Arc::new(LargeStringArray::from(vec![] as Vec<&str>)) as ArrayRef)
            }
            DataType::Boolean => {
                Ok(Arc::new(BooleanArray::from(vec![] as Vec<bool>)) as ArrayRef)
            }
            _ => Err(DataFusionError::NotImplemented(format!(
                "Cannot convert datatype {:?} to array",
                f.data_type()
            ))),
        })
        .collect::<Result<_>>()
        .map_err(DataFusionError::into_arrow_external_error)?;
    RecordBatch::try_new(Arc::new(schema.to_owned()), columns)
}
/// creates an empty record batch.
creates an empty record batch.
creates an empty record batch .
pub fn create_batch_empty(schema: &Schema) -> ArrowResult<RecordBatch> {
    let columns = schema
        .fields()
        .iter()
        .map(|f| match f.data_type() {
            DataType::Float32 => {
                Ok(Arc::new(Float32Array::from(vec![] as Vec<f32>)) as ArrayRef)
            }
            DataType::Float64 => {
                Ok(Arc::new(Float64Array::from(vec![] as Vec<f64>)) as ArrayRef)
            }
            DataType::Int64 => {
                Ok(Arc::new(Int64Array::from(vec![] as Vec<i64>)) as ArrayRef)
            }
            DataType::Int32 => {
                Ok(Arc::new(Int32Array::from(vec![] as Vec<i32>)) as ArrayRef)
            }
            DataType::Int16 => {
                Ok(Arc::new(Int16Array::from(vec![] as Vec<i16>)) as ArrayRef)
            }
            DataType::Int8 => {
                Ok(Arc::new(Int8Array::from(vec![] as Vec<i8>)) as ArrayRef)
            }
            DataType::UInt64 => {
                Ok(Arc::new(UInt64Array::from(vec![] as Vec<u64>)) as ArrayRef)
            }
            DataType::UInt32 => {
                Ok(Arc::new(UInt32Array::from(vec![] as Vec<u32>)) as ArrayRef)
            }
            DataType::UInt16 => {
                Ok(Arc::new(UInt16Array::from(vec![] as Vec<u16>)) as ArrayRef)
            }
            DataType::UInt8 => {
                Ok(Arc::new(UInt8Array::from(vec![] as Vec<u8>)) as ArrayRef)
            }
            DataType::Utf8 => {
                Ok(Arc::new(StringArray::from(vec![] as Vec<&str>)) as ArrayRef)
            }
            DataType::LargeUtf8 => {
                Ok(Arc::new(LargeStringArray::from(vec![] as Vec<&str>)) as ArrayRef)
            }
            DataType::Boolean => {
                Ok(Arc::new(BooleanArray::from(vec![] as Vec<bool>)) as ArrayRef)
            }
            _ => Err(DataFusionError::NotImplemented(format!(
                "Cannot convert datatype {:?} to array",
                f.data_type()
            ))),
        })
        .collect::<Result<_>>()
        .map_err(DataFusionError::into_arrow_external_error)?;
    RecordBatch::try_new(Arc::new(schema.to_owned()), columns)
}
pub fn create_batch_empty ( schema : & Schema ) -> ArrowResult < RecordBatch > { let columns = schema . fields ( ) . iter ( ) . map ( | f | match f . data_type ( ) { DataType :: Float32 => { Ok ( Arc :: new ( Float32Array :: from ( vec ! [ ] as Vec < f32 > ) ) as ArrayRef ) } DataType :: Float64 => { Ok ( Arc :: new ( Float64Array :: from ( vec ! [ ] as Vec < f64 > ) ) as ArrayRef ) } DataType :: Int64 => { Ok ( Arc :: new ( Int64Array :: from ( vec ! [ ] as Vec < i64 > ) ) as ArrayRef ) } DataType :: Int32 => { Ok ( Arc :: new ( Int32Array :: from ( vec ! [ ] as Vec < i32 > ) ) as ArrayRef ) } DataType :: Int16 => { Ok ( Arc :: new ( Int16Array :: from ( vec ! [ ] as Vec < i16 > ) ) as ArrayRef ) } DataType :: Int8 => { Ok ( Arc :: new ( Int8Array :: from ( vec ! [ ] as Vec < i8 > ) ) as ArrayRef ) } DataType :: UInt64 => { Ok ( Arc :: new ( UInt64Array :: from ( vec ! [ ] as Vec < u64 > ) ) as ArrayRef ) } DataType :: UInt32 => { Ok ( Arc :: new ( UInt32Array :: from ( vec ! [ ] as Vec < u32 > ) ) as ArrayRef ) } DataType :: UInt16 => { Ok ( Arc :: new ( UInt16Array :: from ( vec ! [ ] as Vec < u16 > ) ) as ArrayRef ) } DataType :: UInt8 => { Ok ( Arc :: new ( UInt8Array :: from ( vec ! [ ] as Vec < u8 > ) ) as ArrayRef ) } DataType :: Utf8 => { Ok ( Arc :: new ( StringArray :: from ( vec ! [ ] as Vec < & str > ) ) as ArrayRef ) } DataType :: LargeUtf8 => { Ok ( Arc :: new ( LargeStringArray :: from ( vec ! [ ] as Vec < & str > ) ) as ArrayRef ) } DataType :: Boolean => { Ok ( Arc :: new ( BooleanArray :: from ( vec ! [ ] as Vec < bool > ) ) as ArrayRef ) } _ => Err ( DataFusionError :: NotImplemented ( format ! ( " " f data_type ( ) ) ) ) , } ) . collect :: < Result < _ > > ( ) . map_err ( DataFusionError :: into_arrow_external_error ) ? ; RecordBatch :: try_new ( Arc :: new ( schema . to_owned ( ) ) , columns ) }
creates an empty record batch.
creates an empty record batch .
schema
&Schema
schema
&Schema