Content-Length: 5325 | pFad | http://github.com/postgresml/postgresml/pull/1328.diff

thub.com diff --git a/pgml-extension/src/orm/model.rs b/pgml-extension/src/orm/model.rs index 0750c534e..5d1aadbde 100644 --- a/pgml-extension/src/orm/model.rs +++ b/pgml-extension/src/orm/model.rs @@ -955,7 +955,8 @@ impl Model { .map_or(snapshot::NULL_CATEGORY_KEY.to_string(), |k| k.to_string()) } pgrx_pg_sys::NUMERICOID => { - let element: Result, TryFromDatumError> = tuple.get_by_index(index); + let element: Result, TryFromDatumError> = + tuple.get_by_index(index); element .unwrap() .map_or(snapshot::NULL_CATEGORY_KEY.to_string(), |k| k.to_string()) @@ -999,7 +1000,8 @@ impl Model { features.push(element.unwrap().map_or(f32::NAN, |v| v as f32)); } pgrx_pg_sys::NUMERICOID => { - let element: Result, TryFromDatumError> = tuple.get_by_index(index); + let element: Result, TryFromDatumError> = + tuple.get_by_index(index); features.push(element.unwrap().map_or(f32::NAN, |v| v.try_into().unwrap())); } // TODO handle NULL to NaN for arrays diff --git a/pgml-extension/src/orm/snapshot.rs b/pgml-extension/src/orm/snapshot.rs index 1bc27911c..1cecd2a8c 100644 --- a/pgml-extension/src/orm/snapshot.rs +++ b/pgml-extension/src/orm/snapshot.rs @@ -749,7 +749,7 @@ impl Snapshot { .map(|c| c.quoted_name()) .collect::>() .join(", "), - self.relation_name(), + self.relation_name_quoted(), match self.materialized { // If the snapshot is materialized, we already randomized it. true => "", @@ -990,7 +990,10 @@ impl Snapshot { "int8" => row[column.position].value::().unwrap().map(|v| v.to_string()), "float4" => row[column.position].value::().unwrap().map(|v| v.to_string()), "float8" => row[column.position].value::().unwrap().map(|v| v.to_string()), - "numeric" => row[column.position].value::().unwrap().map(|v| v.to_string()), + "numeric" => row[column.position] + .value::() + .unwrap() + .map(|v| v.to_string()), "bpchar" | "text" | "varchar" => { row[column.position].value::().unwrap().map(|v| v.to_string()) } @@ -1084,7 +1087,7 @@ impl Snapshot { check_column_size(column, vec.len()); for j in vec { - vector.push(j.rescale::<6,0>().unwrap().try_into().unwrap()) + vector.push(j.rescale::<6, 0>().unwrap().try_into().unwrap()) } } _ => error!( @@ -1101,7 +1104,10 @@ impl Snapshot { "int8" => row[column.position].value::().unwrap().map(|v| v as f32), "float4" => row[column.position].value::().unwrap(), "float8" => row[column.position].value::().unwrap().map(|v| v as f32), - "numeric" => row[column.position].value::().unwrap().map(|v| v.rescale::<6,0>().unwrap().try_into().unwrap()), + "numeric" => row[column.position] + .value::() + .unwrap() + .map(|v| v.rescale::<6, 0>().unwrap().try_into().unwrap()), _ => error!( "Unhandled type for quantitative scalar column: {} {:?}", column.name, column.pg_type @@ -1156,6 +1162,16 @@ impl Snapshot { false => self.relation_name.clone(), } } + + fn relation_name_quoted(&self) -> String { + match self.materialized { + true => self.snapshot_name(), // Snapshot name is already safe. + false => { + let (schema_name, table_name) = Self::fully_qualified_table(&self.relation_name); + format!("\"{}\".\"{}\"", schema_name, table_name) + } + } + } } #[inline]








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgresml/postgresml/pull/1328.diff

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy