@@ -7,15 +7,14 @@ use arrow::{
77 TimestampMicrosecondBuilder ,
88 } ,
99 datatypes:: {
10- DataType , Date32Type , Field , FieldRef , Float32Type , Float64Type , Int16Type , Int32Type ,
10+ DataType , Date32Type , FieldRef , Float32Type , Float64Type , Int16Type , Int32Type ,
1111 Int64Type , Schema , Time64MicrosecondType , TimeUnit , TimestampMicrosecondType , UInt32Type ,
1212 } ,
1313 error:: ArrowError ,
1414} ;
1515use chrono:: { NaiveDate , NaiveTime } ;
1616use etl:: types:: {
1717 ArrayCell , Cell , DATE_FORMAT , TIME_FORMAT , TIMESTAMP_FORMAT , TableRow ,
18- TableSchema as PgTableSchema , Type as PgType ,
1918} ;
2019
2120pub const UNIX_EPOCH : NaiveDate =
@@ -27,7 +26,7 @@ const UUID_BYTE_WIDTH: i32 = 16;
2726
2827/// Extract numeric precision from Postgres atttypmod
2928/// Based on: https://stackoverflow.com/questions/72725508/how-to-calculate-numeric-precision-and-other-vals-from-atttypmod
30- fn extract_numeric_precision ( atttypmod : i32 ) -> u8 {
29+ pub fn extract_numeric_precision ( atttypmod : i32 ) -> u8 {
3130 if atttypmod == -1 {
3231 // No limit specified, use maximum precision
3332 38
@@ -39,13 +38,13 @@ fn extract_numeric_precision(atttypmod: i32) -> u8 {
3938
4039/// Extract numeric scale from Postgres atttypmod
4140/// Based on: https://stackoverflow.com/questions/72725508/how-to-calculate-numeric-precision-and-other-vals-from-atttypmod
42- fn extract_numeric_scale ( atttypmod : i32 ) -> i8 {
41+ pub fn extract_numeric_scale ( atttypmod : i32 ) -> u8 {
4342 if atttypmod == -1 {
4443 // No limit specified, use reasonable default scale
4544 18
4645 } else {
4746 let scale = ( atttypmod - 4 ) & 65535 ;
48- std:: cmp:: min ( scale as i8 , 38 ) // Cap at reasonable scale
47+ std:: cmp:: min ( scale as u8 , 38 ) // Cap at reasonable scale
4948 }
5049}
5150
0 commit comments