From da044e8fa57df3ba3be18bcd70fc94e4a298f584 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 04:16:48 +0000 Subject: [PATCH 1/3] chore(deps): bump sqlparser from 0.41.0 to 0.52.0 Bumps [sqlparser](https://github.com/apache/datafusion-sqlparser-rs) from 0.41.0 to 0.52.0. - [Changelog](https://github.com/apache/datafusion-sqlparser-rs/blob/main/CHANGELOG.md) - [Commits](https://github.com/apache/datafusion-sqlparser-rs/commits) --- updated-dependencies: - dependency-name: sqlparser dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fb58c7b2..0ff161b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1525,9 +1525,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "sqlparser" -version = "0.41.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc2c25a6c66789625ef164b4c7d2e548d627902280c13710d33da8222169964" +checksum = "9a875d8cd437cc8a97e9aeaeea352ec9a19aea99c23e9effb17757291de80b08" dependencies = [ "log", "sqlparser_derive", diff --git a/Cargo.toml b/Cargo.toml index 21cfb0c3..af15ab4f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ serde_derive = "1" regex = "1" num_cpus = "1" once_cell = "1" -sqlparser = { version = "0.41", features = ["visitor"] } +sqlparser = { version = "0.52", features = ["visitor"] } log = "0.4" arc-swap = "1" parking_lot = "0.12.1" From 328c703e4a23fd21016287d09ab6850c1fd045a2 Mon Sep 17 00:00:00 2001 From: Mostafa Date: Tue, 12 Nov 2024 18:54:25 -0600 Subject: [PATCH 2/3] bump From 2f8eb58bdbfc87f065f62364ad07900ae58bc94a Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Sun, 17 Nov 2024 00:35:34 +0000 Subject: [PATCH 3/3] Update to latest sqlparser version --- src/query_router.rs | 54 ++++++++++++++++----------------------------- 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/src/query_router.rs b/src/query_router.rs index 2ed6b755..3e485a0d 100644 --- a/src/query_router.rs +++ b/src/query_router.rs @@ -504,55 +504,33 @@ impl QueryRouter { let mut table_names = Vec::new(); match q { - Insert { - or, - into: _, - table_name, - columns, - overwrite: _, - source, - partitioned, - after_columns, - table: _, - on: _, - returning: _, - ignore: _, - } => { + Insert(i) => { // Not supported in postgres. - assert!(or.is_none()); - assert!(partitioned.is_none()); - assert!(after_columns.is_empty()); + assert!(i.or.is_none()); + assert!(i.partitioned.is_none()); + assert!(i.after_columns.is_empty()); - Self::process_table(table_name, &mut table_names); - if let Some(source) = source { - Self::process_query(source, &mut exprs, &mut table_names, &Some(columns)); + Self::process_table(&i.table_name, &mut table_names); + if let Some(source) = &i.source { + Self::process_query(source, &mut exprs, &mut table_names, &Some(&i.columns)); } } - Delete { - tables, - from, - using, - selection, - returning: _, - order_by: _, - limit: _, - } => { - if let Some(expr) = selection { + Delete(d) => { + if let Some(expr) = &d.selection { exprs.push(expr.clone()); } // Multi tables delete are not supported in postgres. - assert!(tables.is_empty()); + assert!(d.tables.is_empty()); - Self::process_tables_with_join(from, &mut exprs, &mut table_names); - if let Some(using_tbl_with_join) = using { + if let Some(using_tbl_with_join) = &d.using { Self::process_tables_with_join( using_tbl_with_join, &mut exprs, &mut table_names, ); } - Self::process_selection(selection, &mut exprs); + Self::process_selection(&d.selection, &mut exprs); } Update { table, @@ -822,7 +800,13 @@ impl QueryRouter { for a in assignments { if sharding_key[0].value == "*" - && sharding_key[1].value == a.id.last().unwrap().value.to_lowercase() + && sharding_key[1].value + == a.target + .to_string() + .split('.') + .last() + .unwrap() + .to_lowercase() { return Err(Error::QueryRouterParserError( "Sharding key cannot be updated.".into(),