Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix #1326#1328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
levkk merged 2 commits intomasterfromlevkk-fix-bad-quoting
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletionspgml-extension/src/orm/model.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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<Option<AnyNumeric>, TryFromDatumError> = tuple.get_by_index(index);
let element: Result<Option<AnyNumeric>, TryFromDatumError> =
tuple.get_by_index(index);
element
.unwrap()
.map_or(snapshot::NULL_CATEGORY_KEY.to_string(), |k| k.to_string())
Expand DownExpand Up@@ -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<Option<AnyNumeric>, TryFromDatumError> = tuple.get_by_index(index);
let element: Result<Option<AnyNumeric>, 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
Expand Down
24 changes: 20 additions & 4 deletionspgml-extension/src/orm/snapshot.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -749,7 +749,7 @@ impl Snapshot {
.map(|c| c.quoted_name())
.collect::<Vec<String>>()
.join(", "),
self.relation_name(),
self.relation_name_quoted(),
match self.materialized {
// If the snapshot is materialized, we already randomized it.
true => "",
Expand DownExpand Up@@ -990,7 +990,10 @@ impl Snapshot {
"int8" => row[column.position].value::<i64>().unwrap().map(|v| v.to_string()),
"float4" => row[column.position].value::<f32>().unwrap().map(|v| v.to_string()),
"float8" => row[column.position].value::<f64>().unwrap().map(|v| v.to_string()),
"numeric" => row[column.position].value::<AnyNumeric>().unwrap().map(|v| v.to_string()),
"numeric" => row[column.position]
.value::<AnyNumeric>()
.unwrap()
.map(|v| v.to_string()),
"bpchar" | "text" | "varchar" => {
row[column.position].value::<String>().unwrap().map(|v| v.to_string())
}
Expand DownExpand Up@@ -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!(
Expand All@@ -1101,7 +1104,10 @@ impl Snapshot {
"int8" => row[column.position].value::<i64>().unwrap().map(|v| v as f32),
"float4" => row[column.position].value::<f32>().unwrap(),
"float8" => row[column.position].value::<f64>().unwrap().map(|v| v as f32),
"numeric" => row[column.position].value::<AnyNumeric>().unwrap().map(|v| v.rescale::<6,0>().unwrap().try_into().unwrap()),
"numeric" => row[column.position]
.value::<AnyNumeric>()
.unwrap()
.map(|v| v.rescale::<6, 0>().unwrap().try_into().unwrap()),
_ => error!(
"Unhandled type for quantitative scalar column: {} {:?}",
column.name, column.pg_type
Expand DownExpand Up@@ -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]
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp