Skip to content

Commit b37d105

Browse files
gmemstrdependabot[bot]drdrsh
authored
chore(deps): bump sqlparser from 0.41.0 to 0.52.0 (#870)
* 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] <[email protected]> * bump * Update to latest sqlparser version --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mostafa <[email protected]>
1 parent 32f4752 commit b37d105

File tree

3 files changed

+22
-38
lines changed

3 files changed

+22
-38
lines changed

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ serde_derive = "1"
1919
regex = "1"
2020
num_cpus = "1"
2121
once_cell = "1"
22-
sqlparser = { version = "0.41", features = ["visitor"] }
22+
sqlparser = { version = "0.52", features = ["visitor"] }
2323
log = "0.4"
2424
arc-swap = "1"
2525
parking_lot = "0.12.1"

src/query_router.rs

+19-35
Original file line numberDiff line numberDiff line change
@@ -504,55 +504,33 @@ impl QueryRouter {
504504
let mut table_names = Vec::new();
505505

506506
match q {
507-
Insert {
508-
or,
509-
into: _,
510-
table_name,
511-
columns,
512-
overwrite: _,
513-
source,
514-
partitioned,
515-
after_columns,
516-
table: _,
517-
on: _,
518-
returning: _,
519-
ignore: _,
520-
} => {
507+
Insert(i) => {
521508
// Not supported in postgres.
522-
assert!(or.is_none());
523-
assert!(partitioned.is_none());
524-
assert!(after_columns.is_empty());
509+
assert!(i.or.is_none());
510+
assert!(i.partitioned.is_none());
511+
assert!(i.after_columns.is_empty());
525512

526-
Self::process_table(table_name, &mut table_names);
527-
if let Some(source) = source {
528-
Self::process_query(source, &mut exprs, &mut table_names, &Some(columns));
513+
Self::process_table(&i.table_name, &mut table_names);
514+
if let Some(source) = &i.source {
515+
Self::process_query(source, &mut exprs, &mut table_names, &Some(&i.columns));
529516
}
530517
}
531-
Delete {
532-
tables,
533-
from,
534-
using,
535-
selection,
536-
returning: _,
537-
order_by: _,
538-
limit: _,
539-
} => {
540-
if let Some(expr) = selection {
518+
Delete(d) => {
519+
if let Some(expr) = &d.selection {
541520
exprs.push(expr.clone());
542521
}
543522

544523
// Multi tables delete are not supported in postgres.
545-
assert!(tables.is_empty());
524+
assert!(d.tables.is_empty());
546525

547-
Self::process_tables_with_join(from, &mut exprs, &mut table_names);
548-
if let Some(using_tbl_with_join) = using {
526+
if let Some(using_tbl_with_join) = &d.using {
549527
Self::process_tables_with_join(
550528
using_tbl_with_join,
551529
&mut exprs,
552530
&mut table_names,
553531
);
554532
}
555-
Self::process_selection(selection, &mut exprs);
533+
Self::process_selection(&d.selection, &mut exprs);
556534
}
557535
Update {
558536
table,
@@ -822,7 +800,13 @@ impl QueryRouter {
822800

823801
for a in assignments {
824802
if sharding_key[0].value == "*"
825-
&& sharding_key[1].value == a.id.last().unwrap().value.to_lowercase()
803+
&& sharding_key[1].value
804+
== a.target
805+
.to_string()
806+
.split('.')
807+
.last()
808+
.unwrap()
809+
.to_lowercase()
826810
{
827811
return Err(Error::QueryRouterParserError(
828812
"Sharding key cannot be updated.".into(),

0 commit comments

Comments
 (0)