pub fn make_data_type(sql_type: &SQLDataType) -> Result<DataTypePtr> {
        match sql_type {
            SQLDataType::BigInt(_) => Ok(i64::to_data_type()),
            SQLDataType::Int(_) => Ok(i32::to_data_type()),
            SQLDataType::SmallInt(_) => Ok(i16::to_data_type()),
            SQLDataType::TinyInt(_) => Ok(i8::to_data_type()),
            SQLDataType::Char(_)
            | SQLDataType::Varchar(_)
            | SQLDataType::String
            | SQLDataType::Text => Ok(Vu8::to_data_type()),

            SQLDataType::Decimal(_, _) => Ok(f64::to_data_type()),
            SQLDataType::Float(_) => Ok(f32::to_data_type()),
            SQLDataType::Real | SQLDataType::Double => Ok(f64::to_data_type()),
            SQLDataType::Boolean => Ok(bool::to_data_type()),
            SQLDataType::Date => Ok(Date16Type::arc()),
            SQLDataType::Timestamp => Ok(DateTime32Type::arc(None)),

            //custom types for databend
            // Custom(ObjectName([Ident { value: "uint8", quote_style: None }])
            SQLDataType::Custom(obj) if !obj.0.is_empty() => {
                match obj.0[0].value.to_uppercase().as_str() {
                    "SIGNED" => Ok(i64::to_data_type()),
                    "UNSIGNED" => Ok(u64::to_data_type()),

                    name => {
                        let factory = TypeFactory::instance();
                        let data_type = factory.get(name)?;
                        Ok(data_type.clone())
                    }
                }
            }
            _ => Result::Err(ErrorCode::IllegalDataType(format!(
                "The SQL data type {sql_type:?} is not implemented",
            ))),
        }
    }
/// Maps the SQL type to the corresponding Arrow `DataType`
Maps the SQL type to the corresponding Arrow `DataType`
Maps the SQL type to the corresponding Arrow ` DataType `
pub fn make_data_type(sql_type: &SQLDataType) -> Result<DataTypePtr> {
        match sql_type {
            SQLDataType::BigInt(_) => Ok(i64::to_data_type()),
            SQLDataType::Int(_) => Ok(i32::to_data_type()),
            SQLDataType::SmallInt(_) => Ok(i16::to_data_type()),
            SQLDataType::TinyInt(_) => Ok(i8::to_data_type()),
            SQLDataType::Char(_)
            | SQLDataType::Varchar(_)
            | SQLDataType::String
            | SQLDataType::Text => Ok(Vu8::to_data_type()),
            SQLDataType::Decimal(_, _) => Ok(f64::to_data_type()),
            SQLDataType::Float(_) => Ok(f32::to_data_type()),
            SQLDataType::Real | SQLDataType::Double => Ok(f64::to_data_type()),
            SQLDataType::Boolean => Ok(bool::to_data_type()),
            SQLDataType::Date => Ok(Date16Type::arc()),
            SQLDataType::Timestamp => Ok(DateTime32Type::arc(None)),
            //custom types for databend
            // Custom(ObjectName([Ident { value: "uint8", quote_style: None }])
            SQLDataType::Custom(obj) if !obj.0.is_empty() => {
                match obj.0[0].value.to_uppercase().as_str() {
                    "SIGNED" => Ok(i64::to_data_type()),
                    "UNSIGNED" => Ok(u64::to_data_type()),
                    name => {
                        let factory = TypeFactory::instance();
                        let data_type = factory.get(name)?;
                        Ok(data_type.clone())
                    }
                }
            }
            _ => Result::Err(ErrorCode::IllegalDataType(format!(
                "The SQL data type {sql_type:?} is not implemented",
            ))),
        }
    }
pub fn make_data_type ( sql_type : & SQLDataType ) -> Result < DataTypePtr > { match sql_type { SQLDataType :: BigInt ( _ ) => Ok ( i64 :: to_data_type ( ) ) , SQLDataType :: Int ( _ ) => Ok ( i32 :: to_data_type ( ) ) , SQLDataType :: SmallInt ( _ ) => Ok ( i16 :: to_data_type ( ) ) , SQLDataType :: TinyInt ( _ ) => Ok ( i8 :: to_data_type ( ) ) , SQLDataType :: Char ( _ ) | SQLDataType :: Varchar ( _ ) | SQLDataType :: String | SQLDataType :: Text => Ok ( Vu8 :: to_data_type ( ) ) , SQLDataType :: Decimal ( _ , _ ) => Ok ( f64 :: to_data_type ( ) ) , SQLDataType :: Float ( _ ) => Ok ( f32 :: to_data_type ( ) ) , SQLDataType :: Real | SQLDataType :: Double => Ok ( f64 :: to_data_type ( ) ) , SQLDataType :: Boolean => Ok ( bool :: to_data_type ( ) ) , SQLDataType :: Date => Ok ( Date16Type :: arc ( ) ) , SQLDataType :: Timestamp => Ok ( DateTime32Type :: arc ( None ) ) , //custom types for databend // Custom(ObjectName([Ident { value: "uint8", quote_style: None }]) SQLDataType :: Custom ( obj ) if ! obj . 0 . is_empty ( ) => { match obj . 0 [ 0 ] . value . to_uppercase ( ) . as_str ( ) { " " => Ok ( i64 :: to_data_type ( ) ) , " " => Ok ( u64 :: to_data_type ( ) ) , name => { let factory = TypeFactory :: instance ( ) ; let data_type = factory . get ( name ) ? ; Ok ( data_type . clone ( ) ) } } } _ => Result :: Err ( ErrorCode :: IllegalDataType ( format ! ( " " ) ) ) , } }
Maps the SQL type to the corresponding Arrow `DataType`
Maps the SQL type to the corresponding Arrow ` DataType `
sql_type
&SQLDataType