Skip to content

Commit aeeb05f

Browse files
committed
add support for vectors in datasets
1 parent 39749dd commit aeeb05f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

pgml-extension/src/bindings/transformers.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ pub fn generate(model_id: i64, inputs: Vec<&str>, config: JsonB) -> Vec<String>
116116
let result = match result {
117117
Err(e) => {
118118
if e.get_type(py).name().unwrap() == "MissingModelError" {
119+
info!("Loading model into cache for connection reuse");
119120
let mut dir = std::path::PathBuf::from("/tmp/postgresml/models");
120121
dir.push(model_id.to_string());
121122
if !dir.exists() {
@@ -220,18 +221,15 @@ pub fn load_dataset(
220221
.map(|(name, type_)| {
221222
let type_ = match type_.as_str().unwrap() {
222223
"string" => "TEXT",
223-
"dict" => "JSONB",
224+
"dict" | "list" => "JSONB",
224225
"int64" => "INT8",
225226
"int32" => "INT4",
226227
"int16" => "INT2",
227228
"float64" => "FLOAT8",
228229
"float32" => "FLOAT4",
229230
"float16" => "FLOAT4",
230231
"bool" => "BOOLEAN",
231-
_ => error!(
232-
"unhandled dataset feature while reading dataset: {:?}",
233-
type_
234-
),
232+
_ => error!("unhandled dataset feature while reading dataset: {}", type_),
235233
};
236234
format!("{name} {type_}")
237235
})
@@ -270,7 +268,7 @@ pub fn load_dataset(
270268
PgBuiltInOids::TEXTOID.oid(),
271269
value.as_str().unwrap().into_datum(),
272270
)),
273-
"dict" => row.push((
271+
"dict" | "list" => row.push((
274272
PgBuiltInOids::JSONBOID.oid(),
275273
JsonB(value.clone()).into_datum(),
276274
)),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy