Skip to content

Commit 06fa7cc

Browse files
authored
Update to sqlparser 0.17.0 (#2500)
* fix: Update parser for indexed field * Update to sqlparser 0.17 * Update more cargo * Fix test to use string key rather than identifier
1 parent a7c3b08 commit 06fa7cc

File tree

8 files changed

+71
-58
lines changed

8 files changed

+71
-58
lines changed

ballista/rust/client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ datafusion = { path = "../../../datafusion/core", version = "7.0.0" }
3636
futures = "0.3"
3737
log = "0.4"
3838
parking_lot = "0.12"
39-
sqlparser = "0.16"
39+
sqlparser = "0.17"
4040
tempfile = "3"
4141
tokio = "1.0"
4242

ballista/rust/core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ parse_arg = "0.1.3"
5353
prost = "0.10"
5454
prost-types = "0.10"
5555
serde = { version = "1", features = ["derive"] }
56-
sqlparser = "0.16"
56+
sqlparser = "0.17"
5757
tokio = "1.0"
5858
tonic = "0.7"
5959
uuid = { version = "1.0", features = ["v4"] }

datafusion-cli/Cargo.lock

Lines changed: 58 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datafusion/common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ cranelift-module = { version = "0.83.0", optional = true }
4444
ordered-float = "3.0"
4545
parquet = { version = "13", features = ["arrow"], optional = true }
4646
pyo3 = { version = "0.16", optional = true }
47-
sqlparser = "0.16"
47+
sqlparser = "0.17"

datafusion/core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pyo3 = { version = "0.16", optional = true }
8080
rand = "0.8"
8181
rayon = { version = "1.5", optional = true }
8282
smallvec = { version = "1.6", features = ["union"] }
83-
sqlparser = "0.16"
83+
sqlparser = "0.17"
8484
tempfile = "3"
8585
tokio = { version = "1.0", features = ["macros", "rt", "rt-multi-thread", "sync", "fs", "parking_lot"] }
8686
tokio-stream = "0.1"

datafusion/core/src/sql/planner.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn plan_key(key: SQLExpr) -> Result<ScalarValue> {
9999
SQLExpr::Value(Value::SingleQuotedString(s)) => ScalarValue::Utf8(Some(s)),
100100
_ => {
101101
return Err(DataFusionError::SQL(ParserError(format!(
102-
"Unsuported index key expression: {}",
102+
"Unsuported index key expression: {:?}",
103103
key
104104
))))
105105
}
@@ -1645,6 +1645,11 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
16451645
}
16461646
}
16471647

1648+
SQLExpr::ArrayIndex { obj, indexs } => {
1649+
let expr = self.sql_expr_to_logical_expr(*obj, schema, ctes)?;
1650+
plan_indexed(expr, indexs)
1651+
}
1652+
16481653
SQLExpr::CompoundIdentifier(ids) => {
16491654
let mut var_names: Vec<_> = ids.into_iter().map(|s| normalize_ident(&s)).collect();
16501655

datafusion/core/tests/sql/select.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ async fn query_nested_get_indexed_field_on_struct() -> Result<()> {
639639
ctx.register_table("structs", table_a)?;
640640

641641
// Original column is micros, convert to millis and check timestamp
642-
let sql = "SELECT some_struct[\"bar\"] as l0 FROM structs LIMIT 3";
642+
let sql = "SELECT some_struct['bar'] as l0 FROM structs LIMIT 3";
643643
let actual = execute_to_batches(&ctx, sql).await;
644644
let expected = vec![
645645
"+----------------+",
@@ -666,7 +666,7 @@ async fn query_nested_get_indexed_field_on_struct() -> Result<()> {
666666
];
667667
assert_batches_eq!(expected, &actual);
668668

669-
let sql = "SELECT some_struct[\"bar\"][0] as i0 FROM structs LIMIT 3";
669+
let sql = "SELECT some_struct['bar'][0] as i0 FROM structs LIMIT 3";
670670
let actual = execute_to_batches(&ctx, sql).await;
671671
#[rustfmt::skip]
672672
let expected = vec![

datafusion/expr/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ path = "src/lib.rs"
3838
ahash = { version = "0.7", default-features = false }
3939
arrow = { version = "13", features = ["prettyprint"] }
4040
datafusion-common = { path = "../common", version = "7.0.0" }
41-
sqlparser = "0.16"
41+
sqlparser = "0.17"

0 commit comments

Comments
 (0)