diff --git a/Cargo.lock b/Cargo.lock index ebb60dc150e8..b3de90cbd2c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4795,9 +4795,9 @@ dependencies = [ [[package]] name = "sqlparser" -version = "0.60.0" +version = "0.61.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "505aa16b045c4c1375bf5f125cce3813d0176325bfe9ffc4a903f423de7774ff" +checksum = "dbf5ea8d4d7c808e1af1cbabebca9a2abe603bcefc22294c5b95018d53200cb7" dependencies = [ "log", "recursive", @@ -4806,9 +4806,9 @@ dependencies = [ [[package]] name = "sqlparser_derive" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "028e551d5e270b31b9f3ea271778d9d827148d4287a5d96167b6bb9787f5cc38" +checksum = "a6dd45d8fc1c79299bfbb7190e42ccbbdf6a5f52e4a6ad98d92357ea965bd289" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index da2494663a55..310534d424a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -96,7 +96,7 @@ sha2 = "0.10" simd-json = { version = "0.17", features = ["known-key", "128bit"] } simdutf8 = "0.1.4" slotmap = "1" -sqlparser = { version = "0.60", features = ["visitor"] } +sqlparser = { version = "0.61", features = ["visitor"] } stacker = "0.1" streaming-iterator = "0.1.9" strength_reduce = "0.2" diff --git a/crates/polars-sql/src/context.rs b/crates/polars-sql/src/context.rs index dd841c60a4ee..28c09a2eb06b 100644 --- a/crates/polars-sql/src/context.rs +++ b/crates/polars-sql/src/context.rs @@ -754,6 +754,7 @@ impl SQLContext { order_by, limit, delete_token: _, + optimizer_hint: _, }) = stmt { let error_message: Option<&'static str> = if !tables.is_empty() { @@ -1027,7 +1028,9 @@ impl SQLContext { ref exclude, ref into, ref lateral_views, + ref optimizer_hint, ref prewhere, + ref select_modifiers, ref sort_by, ref top, ref value_table_mode, @@ -1035,12 +1038,14 @@ impl SQLContext { // Raise specific error messages for unsupported attributes polars_ensure!(cluster_by.is_empty(), SQLInterface: "`CLUSTER BY` clause is not supported"); - polars_ensure!(connect_by.is_none(), SQLInterface: "`CONNECT BY` clause is not supported"); + polars_ensure!(connect_by.is_empty(), SQLInterface: "`CONNECT BY` clause is not supported"); polars_ensure!(distribute_by.is_empty(), SQLInterface: "`DISTRIBUTE BY` clause is not supported"); polars_ensure!(exclude.is_none(), SQLInterface: "`EXCLUDE` clause is not supported"); polars_ensure!(into.is_none(), SQLInterface: "`SELECT INTO` clause is not supported"); polars_ensure!(lateral_views.is_empty(), SQLInterface: "`LATERAL VIEW` clause is not supported"); + polars_ensure!(optimizer_hint.is_none(), SQLInterface: "optimizer hints are not supported"); polars_ensure!(prewhere.is_none(), SQLInterface: "`PREWHERE` clause is not supported"); + polars_ensure!(select_modifiers.is_none(), SQLInterface: "select modifiers are not supported"); polars_ensure!(sort_by.is_empty(), SQLInterface: "`SORT BY` clause is not supported; use `ORDER BY` instead"); polars_ensure!(top.is_none(), SQLInterface: "`TOP` clause is not supported; use `LIMIT` instead"); polars_ensure!(value_table_mode.is_none(), SQLInterface: "`SELECT AS VALUE/STRUCT` is not supported"); @@ -1454,7 +1459,7 @@ impl SQLContext { UniqueKeepStrategy::First, )); }, - None => lf, + Some(Distinct::All) | None => lf, }; Ok(lf) } @@ -1796,8 +1801,11 @@ impl SQLContext { lateral, subquery, alias, + sample, } => { - polars_ensure!(!(*lateral), SQLInterface: "LATERAL not supported"); + polars_ensure!(!(*lateral), SQLInterface: "LATERAL is not supported"); + polars_ensure!(sample.is_none(), SQLInterface: "SAMPLE is not supported"); + if let Some(alias) = alias { let mut lf = self.execute_query_no_ctes(subquery)?; lf = self.rename_columns_from_table_alias(lf, alias)?; diff --git a/crates/polars-sql/src/sql_expr.rs b/crates/polars-sql/src/sql_expr.rs index 0c5b534cecf4..724c77d5ab92 100644 --- a/crates/polars-sql/src/sql_expr.rs +++ b/crates/polars-sql/src/sql_expr.rs @@ -107,6 +107,7 @@ impl SQLExprVisitor<'_> { expr, data_type, format, + array: _, } => self.visit_cast(expr, data_type, format, kind), SQLExpr::Ceil { expr, .. } => Ok(self.visit_expr(expr)?.ceil()), SQLExpr::CompoundFieldAccess { root, access_chain } => {