From 4e6cd036974f0c7656374162ff896b4bf37130a0 Mon Sep 17 00:00:00 2001 From: Ayush Dattagupta Date: Tue, 16 Aug 2022 13:48:55 -0700 Subject: [PATCH 1/2] Update sqlparser version to use main from git --- datafusion/common/Cargo.toml | 2 +- datafusion/core/Cargo.toml | 2 +- datafusion/expr/Cargo.toml | 2 +- datafusion/sql/Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/datafusion/common/Cargo.toml b/datafusion/common/Cargo.toml index 22d728d50a34..55d3bd61308c 100644 --- a/datafusion/common/Cargo.toml +++ b/datafusion/common/Cargo.toml @@ -47,4 +47,4 @@ ordered-float = "3.0" parquet = { version = "20.0.0", features = ["arrow"], optional = true } pyo3 = { version = "0.16", optional = true } serde_json = "1.0" -sqlparser = { git = "https://github.com/sqlparser-rs/sqlparser-rs", rev = "31ba0012f747c9e2fc551b95fd2ee3bfa46b12e6" } +sqlparser = { git = "https://github.com/sqlparser-rs/sqlparser-rs", rev = "42c5d43b45d3e7a573ac24dd5c927c43bbd3768c" } diff --git a/datafusion/core/Cargo.toml b/datafusion/core/Cargo.toml index 3f84d9618059..92b6acc94375 100644 --- a/datafusion/core/Cargo.toml +++ b/datafusion/core/Cargo.toml @@ -85,7 +85,7 @@ pyo3 = { version = "0.16", optional = true } rand = "0.8" rayon = { version = "1.5", optional = true } smallvec = { version = "1.6", features = ["union"] } -sqlparser = { git = "https://github.com/sqlparser-rs/sqlparser-rs", rev = "31ba0012f747c9e2fc551b95fd2ee3bfa46b12e6" } +sqlparser = { git = "https://github.com/sqlparser-rs/sqlparser-rs", rev = "42c5d43b45d3e7a573ac24dd5c927c43bbd3768c" } tempfile = "3" tokio = { version = "1.0", features = ["macros", "rt", "rt-multi-thread", "sync", "fs", "parking_lot"] } tokio-stream = "0.1" diff --git a/datafusion/expr/Cargo.toml b/datafusion/expr/Cargo.toml index 6ff3bb8c0e0e..93b3b6c895f4 100644 --- a/datafusion/expr/Cargo.toml +++ b/datafusion/expr/Cargo.toml @@ -38,4 +38,4 @@ path = "src/lib.rs" ahash = { version = "0.8", default-features = false, features = ["runtime-rng"] } arrow = { version = "20.0.0", features = ["prettyprint"] } datafusion-common = { path = "../common", version = "11.0.0" } -sqlparser = { git = "https://github.com/sqlparser-rs/sqlparser-rs", rev = "31ba0012f747c9e2fc551b95fd2ee3bfa46b12e6" } +sqlparser = { git = "https://github.com/sqlparser-rs/sqlparser-rs", rev = "42c5d43b45d3e7a573ac24dd5c927c43bbd3768c" } diff --git a/datafusion/sql/Cargo.toml b/datafusion/sql/Cargo.toml index 573005836a58..a35f5b87c0c8 100644 --- a/datafusion/sql/Cargo.toml +++ b/datafusion/sql/Cargo.toml @@ -42,5 +42,5 @@ arrow = { version = "20.0.0", features = ["prettyprint"] } datafusion-common = { path = "../common", version = "11.0.0" } datafusion-expr = { path = "../expr", version = "11.0.0" } hashbrown = "0.12" -sqlparser = { git = "https://github.com/sqlparser-rs/sqlparser-rs", rev = "31ba0012f747c9e2fc551b95fd2ee3bfa46b12e6" } +sqlparser = { git = "https://github.com/sqlparser-rs/sqlparser-rs", rev = "42c5d43b45d3e7a573ac24dd5c927c43bbd3768c" } tokio = { version = "1.0", features = ["macros", "rt", "rt-multi-thread", "sync", "fs", "parking_lot"] } From 1e46ff86a60db88e9fabfcf67a948ed53f1c48bd Mon Sep 17 00:00:00 2001 From: Ayush Dattagupta Date: Tue, 16 Aug 2022 13:49:47 -0700 Subject: [PATCH 2/2] Update SqlExpr::Trim struct to match latest sqlparser changes --- datafusion/sql/src/planner.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/datafusion/sql/src/planner.rs b/datafusion/sql/src/planner.rs index 73ba86180e03..359105a9a4f5 100644 --- a/datafusion/sql/src/planner.rs +++ b/datafusion/sql/src/planner.rs @@ -2026,21 +2026,21 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { )) } - SQLExpr::Trim { expr, trim_where } => { - let (fun, where_expr) = match trim_where { - Some((TrimWhereField::Leading, expr)) => { - (BuiltinScalarFunction::Ltrim, Some(expr)) + SQLExpr::Trim { expr, trim_where, trim_what } => { + let fun = match trim_where { + Some(TrimWhereField::Leading) => { + BuiltinScalarFunction::Ltrim } - Some((TrimWhereField::Trailing, expr)) => { - (BuiltinScalarFunction::Rtrim, Some(expr)) + Some(TrimWhereField::Trailing) => { + BuiltinScalarFunction::Rtrim } - Some((TrimWhereField::Both, expr)) => { - (BuiltinScalarFunction::Btrim, Some(expr)) + Some(TrimWhereField::Both) => { + BuiltinScalarFunction::Btrim } - None => (BuiltinScalarFunction::Trim, None), + None => BuiltinScalarFunction::Trim }; let arg = self.sql_expr_to_logical_expr(*expr, schema, ctes)?; - let args = match where_expr { + let args = match trim_what { Some(to_trim) => { let to_trim = self.sql_expr_to_logical_expr(*to_trim, schema, ctes)?; vec![arg, to_trim]