@@ -8,7 +8,7 @@ use deltalake::arrow::array::{
8
8
TimestampMicrosecondArray , UInt32Array , new_empty_array,
9
9
} ;
10
10
use deltalake:: arrow:: datatypes:: {
11
- DataType as ArrowDataType , DecimalType , Field as ArrowField , Schema as ArrowSchema , TimeUnit ,
11
+ DataType as ArrowDataType , Field as ArrowField , Schema as ArrowSchema , TimeUnit ,
12
12
} ;
13
13
use deltalake:: arrow:: error:: ArrowError ;
14
14
use deltalake:: arrow:: record_batch:: RecordBatch ;
@@ -758,12 +758,17 @@ pub(crate) fn postgres_to_delta_schema(schema: &PgTableSchema) -> DeltaResult<De
758
758
} )
759
759
. collect :: < Result < Vec < _ > , deltalake:: DeltaTableError > > ( ) ?;
760
760
761
- Ok ( DeltaSchema :: new ( fields) )
761
+ let delta_schema = DeltaSchema :: try_new ( fields) ?;
762
+ Ok ( delta_schema)
762
763
}
763
764
764
765
#[ cfg( test) ]
765
766
mod tests {
766
767
use super :: * ;
768
+ use chrono:: { DateTime , NaiveDate , NaiveDateTime , NaiveTime , Utc } ;
769
+ use deltalake:: { DecimalType , PrimitiveType } ;
770
+ use etl:: types:: { ColumnSchema , TableName , TableSchema as PgTableSchema , Type as PgType } ;
771
+ use uuid:: Uuid ;
767
772
768
773
fn create_test_schema ( ) -> PgTableSchema {
769
774
PgTableSchema {
@@ -970,10 +975,6 @@ mod tests {
970
975
}
971
976
}
972
977
973
- use chrono:: { DateTime , NaiveDate , NaiveDateTime , NaiveTime , Utc } ;
974
- use etl:: types:: { ColumnSchema , TableName , TableSchema as PgTableSchema , Type as PgType } ;
975
- use uuid:: Uuid ;
976
-
977
978
#[ test]
978
979
fn test_empty_table_rows ( ) {
979
980
let schema = create_test_schema ( ) ;
0 commit comments