@@ -7,15 +7,14 @@ use arrow::{
7
7
TimestampMicrosecondBuilder ,
8
8
} ,
9
9
datatypes:: {
10
- DataType , Date32Type , Field , FieldRef , Float32Type , Float64Type , Int16Type , Int32Type ,
10
+ DataType , Date32Type , FieldRef , Float32Type , Float64Type , Int16Type , Int32Type ,
11
11
Int64Type , Schema , Time64MicrosecondType , TimeUnit , TimestampMicrosecondType , UInt32Type ,
12
12
} ,
13
13
error:: ArrowError ,
14
14
} ;
15
15
use chrono:: { NaiveDate , NaiveTime } ;
16
16
use etl:: types:: {
17
17
ArrayCell , Cell , DATE_FORMAT , TIME_FORMAT , TIMESTAMP_FORMAT , TableRow ,
18
- TableSchema as PgTableSchema , Type as PgType ,
19
18
} ;
20
19
21
20
pub const UNIX_EPOCH : NaiveDate =
@@ -27,7 +26,7 @@ const UUID_BYTE_WIDTH: i32 = 16;
27
26
28
27
/// Extract numeric precision from Postgres atttypmod
29
28
/// 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 {
31
30
if atttypmod == -1 {
32
31
// No limit specified, use maximum precision
33
32
38
@@ -39,13 +38,13 @@ fn extract_numeric_precision(atttypmod: i32) -> u8 {
39
38
40
39
/// Extract numeric scale from Postgres atttypmod
41
40
/// 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 {
43
42
if atttypmod == -1 {
44
43
// No limit specified, use reasonable default scale
45
44
18
46
45
} else {
47
46
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
49
48
}
50
49
}
51
50
0 commit comments