@@ -954,6 +954,12 @@ impl Model {
954954 . unwrap ( )
955955 . map_or ( snapshot:: NULL_CATEGORY_KEY . to_string ( ) , |k| k. to_string ( ) )
956956 }
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+ }
957963 _ => error ! (
958964 "Unsupported type for categorical column: {:?}. oid: {:?}" ,
959965 column. name, attribute. atttypid
@@ -992,6 +998,10 @@ impl Model {
992998 let element: Result < Option < f64 > , TryFromDatumError > = tuple. get_by_index ( index) ;
993999 features. push ( element. unwrap ( ) . map_or ( f32:: NAN , |v| v as f32 ) ) ;
9941000 }
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+ }
9951005 // TODO handle NULL to NaN for arrays
9961006 pgrx_pg_sys:: BOOLARRAYOID => {
9971007 let element: Result < Option < Vec < bool > > , TryFromDatumError > =
@@ -1035,6 +1045,13 @@ impl Model {
10351045 features. push ( * j as f32 ) ;
10361046 }
10371047 }
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+ }
10381055 _ => error ! (
10391056 "Unsupported type for quantitative column: {:?}. oid: {:?}" ,
10401057 column. name, attribute. atttypid
0 commit comments