@@ -101,7 +101,7 @@ pub type DFSchemaRef = Arc<DFSchema>;
101
101
/// let df_schema = DFSchema::from_unqualified_fields(vec![
102
102
/// Field::new("c1", arrow::datatypes::DataType::Int32, false),
103
103
/// ].into(),HashMap::new()).unwrap();
104
- /// let schema = Schema::from( df_schema);
104
+ /// let schema: &Schema = df_schema.as_arrow( );
105
105
/// assert_eq!(schema.fields().len(), 1);
106
106
/// ```
107
107
#[ derive( Debug , Clone , PartialEq , Eq ) ]
@@ -594,7 +594,7 @@ impl DFSchema {
594
594
& self ,
595
595
arrow_schema : & Schema ,
596
596
) -> Result < ( ) > {
597
- let self_arrow_schema: Schema = self . into ( ) ;
597
+ let self_arrow_schema = self . as_arrow ( ) ;
598
598
self_arrow_schema
599
599
. fields ( )
600
600
. iter ( )
@@ -1081,22 +1081,6 @@ fn format_simple_data_type(data_type: &DataType) -> String {
1081
1081
}
1082
1082
}
1083
1083
1084
- impl From < DFSchema > for Schema {
1085
- /// Convert DFSchema into a Schema
1086
- fn from ( df_schema : DFSchema ) -> Self {
1087
- let fields: Fields = df_schema. inner . fields . clone ( ) ;
1088
- Schema :: new_with_metadata ( fields, df_schema. inner . metadata . clone ( ) )
1089
- }
1090
- }
1091
-
1092
- impl From < & DFSchema > for Schema {
1093
- /// Convert DFSchema reference into a Schema
1094
- fn from ( df_schema : & DFSchema ) -> Self {
1095
- let fields: Fields = df_schema. inner . fields . clone ( ) ;
1096
- Schema :: new_with_metadata ( fields, df_schema. inner . metadata . clone ( ) )
1097
- }
1098
- }
1099
-
1100
1084
/// Allow DFSchema to be converted into an Arrow `&Schema`
1101
1085
impl AsRef < Schema > for DFSchema {
1102
1086
fn as_ref ( & self ) -> & Schema {
@@ -1138,12 +1122,6 @@ impl TryFrom<SchemaRef> for DFSchema {
1138
1122
}
1139
1123
}
1140
1124
1141
- impl From < DFSchema > for SchemaRef {
1142
- fn from ( df_schema : DFSchema ) -> Self {
1143
- SchemaRef :: new ( df_schema. into ( ) )
1144
- }
1145
- }
1146
-
1147
1125
// Hashing refers to a subset of fields considered in PartialEq.
1148
1126
impl Hash for DFSchema {
1149
1127
fn hash < H : std:: hash:: Hasher > ( & self , state : & mut H ) {
@@ -1433,7 +1411,7 @@ mod tests {
1433
1411
#[ test]
1434
1412
fn from_qualified_schema_into_arrow_schema ( ) -> Result < ( ) > {
1435
1413
let schema = DFSchema :: try_from_qualified_schema ( "t1" , & test_schema_1 ( ) ) ?;
1436
- let arrow_schema: Schema = schema. into ( ) ;
1414
+ let arrow_schema = schema. as_arrow ( ) ;
1437
1415
let expected = "Field { name: \" c0\" , data_type: Boolean, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }, \
1438
1416
Field { name: \" c1\" , data_type: Boolean, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }";
1439
1417
assert_eq ! ( expected, arrow_schema. to_string( ) ) ;
0 commit comments