@@ -954,6 +954,12 @@ impl Model {
954
954
. unwrap ( )
955
955
. map_or ( snapshot:: NULL_CATEGORY_KEY . to_string ( ) , |k| k. to_string ( ) )
956
956
}
957
+ pgrx_pg_sys:: NUMERICOID => {
958
+ let element: Result < Option < AnyNumeric > , TryFromDatumError > = tuple. get_by_index ( index) ;
959
+ element
960
+ . unwrap ( )
961
+ . map_or ( snapshot:: NULL_CATEGORY_KEY . to_string ( ) , |k| k. to_string ( ) )
962
+ }
957
963
_ => error ! (
958
964
"Unsupported type for categorical column: {:?}. oid: {:?}" ,
959
965
column. name, attribute. atttypid
@@ -992,6 +998,10 @@ impl Model {
992
998
let element: Result < Option < f64 > , TryFromDatumError > = tuple. get_by_index ( index) ;
993
999
features. push ( element. unwrap ( ) . map_or ( f32:: NAN , |v| v as f32 ) ) ;
994
1000
}
1001
+ pgrx_pg_sys:: NUMERICOID => {
1002
+ let element: Result < Option < AnyNumeric > , TryFromDatumError > = tuple. get_by_index ( index) ;
1003
+ features. push ( element. unwrap ( ) . map_or ( f32:: NAN , |v| v. try_into ( ) . unwrap ( ) ) ) ;
1004
+ }
995
1005
// TODO handle NULL to NaN for arrays
996
1006
pgrx_pg_sys:: BOOLARRAYOID => {
997
1007
let element: Result < Option < Vec < bool > > , TryFromDatumError > =
@@ -1035,6 +1045,13 @@ impl Model {
1035
1045
features. push ( * j as f32 ) ;
1036
1046
}
1037
1047
}
1048
+ pgrx_pg_sys:: NUMERICARRAYOID => {
1049
+ let element: Result < Option < Vec < AnyNumeric > > , TryFromDatumError > =
1050
+ tuple. get_by_index ( index) ;
1051
+ for j in element. as_ref ( ) . unwrap ( ) . as_ref ( ) . unwrap ( ) {
1052
+ features. push ( j. clone ( ) . try_into ( ) . unwrap ( ) ) ;
1053
+ }
1054
+ }
1038
1055
_ => error ! (
1039
1056
"Unsupported type for quantitative column: {:?}. oid: {:?}" ,
1040
1057
column. name, attribute. atttypid
0 commit comments