pub(super) fn fb_to_schema(schema: arrow_format::ipc::SchemaRef) -> Result<(Schema, IpcSchema)> {
    let fields = schema
        .fields()?
        .ok_or_else(|| ArrowError::oos("IPC: Schema must contain fields"))?;
    let (fields, ipc_fields) = try_unzip_vec(fields.iter().map(|field| {
        let (field, fields) = deserialize_field(field?)?;
        Ok((field, fields))
    }))?;

    let is_little_endian = match schema.endianness()? {
        arrow_format::ipc::Endianness::Little => true,
        arrow_format::ipc::Endianness::Big => false,
    };

    let mut metadata = Metadata::default();
    if let Some(md_fields) = schema.custom_metadata()? {
        for kv in md_fields {
            let kv = kv?;
            let k_str = kv.key()?;
            let v_str = kv.value()?;
            if let Some(k) = k_str {
                if let Some(v) = v_str {
                    metadata.insert(k.to_string(), v.to_string());
                }
            }
        }
    }

    Ok((
        Schema { fields, metadata },
        IpcSchema {
            fields: ipc_fields,
            is_little_endian,
        },
    ))
}
/// Deserialize the raw Schema table from IPC format to Schema data type
Deserialize the raw Schema table from IPC format to Schema data type
Deserialize the raw Schema table from IPC format to Schema data type
pub(super) fn fb_to_schema(schema: arrow_format::ipc::SchemaRef) -> Result<(Schema, IpcSchema)> {
    let fields = schema
        .fields()?
        .ok_or_else(|| ArrowError::oos("IPC: Schema must contain fields"))?;
    let (fields, ipc_fields) = try_unzip_vec(fields.iter().map(|field| {
        let (field, fields) = deserialize_field(field?)?;
        Ok((field, fields))
    }))?;
    let is_little_endian = match schema.endianness()? {
        arrow_format::ipc::Endianness::Little => true,
        arrow_format::ipc::Endianness::Big => false,
    };
    let mut metadata = Metadata::default();
    if let Some(md_fields) = schema.custom_metadata()? {
        for kv in md_fields {
            let kv = kv?;
            let k_str = kv.key()?;
            let v_str = kv.value()?;
            if let Some(k) = k_str {
                if let Some(v) = v_str {
                    metadata.insert(k.to_string(), v.to_string());
                }
            }
        }
    }
    Ok((
        Schema { fields, metadata },
        IpcSchema {
            fields: ipc_fields,
            is_little_endian,
        },
    ))
}
pub ( super ) fn fb_to_schema ( schema : arrow_format :: ipc :: SchemaRef ) -> Result < ( Schema , IpcSchema ) > { let fields = schema . fields ( ) ? . ok_or_else ( | | ArrowError :: oos ( " " ) ) ? ; let ( fields , ipc_fields ) = try_unzip_vec ( fields . iter ( ) . map ( | field | { let ( field , fields ) = deserialize_field ( field ? ) ? ; Ok ( ( field , fields ) ) } ) ) ? ; let is_little_endian = match schema . endianness ( ) ? { arrow_format :: ipc :: Endianness :: Little => true , arrow_format :: ipc :: Endianness :: Big => false , } ; let mut metadata = Metadata :: default ( ) ; if let Some ( md_fields ) = schema . custom_metadata ( ) ? { for kv in md_fields { let kv = kv ? ; let k_str = kv . key ( ) ? ; let v_str = kv . value ( ) ? ; if let Some ( k ) = k_str { if let Some ( v ) = v_str { metadata . insert ( k . to_string ( ) , v . to_string ( ) ) ; } } } } Ok ( ( Schema { fields , metadata } , IpcSchema { fields : ipc_fields , is_little_endian , } , ) ) }
Deserialize the raw Schema table from IPC format to Schema data type
Deserialize the raw Schema table from IPC format to Schema data type
schema
arrow_format::ipc::SchemaRef
schema
arrow_format::ipc::SchemaRef