diff --git a/Cargo.lock b/Cargo.lock index 6a45d67914..baffa08870 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4825,9 +4825,9 @@ dependencies = [ [[package]] name = "sqlparser" -version = "0.23.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0beb13adabbdda01b63d595f38c8bfd19a361e697fd94ce0098a634077bc5b25" +checksum = "db67dc6ef36edb658196c3fef0464a80b53dbbc194a904e81f9bd4190f9ecc5b" dependencies = [ "log", "serde", diff --git a/crates/nu-command/Cargo.toml b/crates/nu-command/Cargo.toml index ce6d426315..91b2cf3d78 100644 --- a/crates/nu-command/Cargo.toml +++ b/crates/nu-command/Cargo.toml @@ -100,7 +100,7 @@ which = { version = "4.3.0", optional = true } reedline = { version = "0.14.0", features = ["bashisms", "sqlite"] } wax = { version = "0.5.0" } rusqlite = { version = "0.28.0", features = ["bundled"], optional = true } -sqlparser = { version = "0.23.0", features = ["serde"], optional = true } +sqlparser = { version = "0.30.0", features = ["serde"], optional = true } [target.'cfg(windows)'.dependencies] winreg = "0.10.1" diff --git a/crates/nu-command/src/dataframe/eager/sql_context.rs b/crates/nu-command/src/dataframe/eager/sql_context.rs index 4ae2b77849..a75694232f 100644 --- a/crates/nu-command/src/dataframe/eager/sql_context.rs +++ b/crates/nu-command/src/dataframe/eager/sql_context.rs @@ -85,7 +85,7 @@ impl SQLContext { raw_projection_before_alias.insert(format!("{:?}", expr), i); expr.alias(&alias.value) } - SelectItem::QualifiedWildcard(_) | SelectItem::Wildcard => { + SelectItem::QualifiedWildcard(_, _) | SelectItem::Wildcard(_) => { contain_wildcard = true; col("*") } diff --git a/crates/nu-command/src/dataframe/eager/sql_expr.rs b/crates/nu-command/src/dataframe/eager/sql_expr.rs index 5a7f6aadae..978582ea18 100644 --- a/crates/nu-command/src/dataframe/eager/sql_expr.rs +++ b/crates/nu-command/src/dataframe/eager/sql_expr.rs @@ -28,12 +28,17 @@ fn map_sql_polars_datatype(data_type: &SQLDataType) -> Result { SQLDataType::Boolean => DataType::Boolean, SQLDataType::Date => DataType::Date, - SQLDataType::Time => DataType::Time, - SQLDataType::Timestamp => DataType::Datetime(TimeUnit::Milliseconds, None), + SQLDataType::Time(_, _) => DataType::Time, + SQLDataType::Timestamp(_, _) => DataType::Datetime(TimeUnit::Milliseconds, None), SQLDataType::Interval => DataType::Duration(TimeUnit::Milliseconds), - SQLDataType::Array(inner_type) => { - DataType::List(Box::new(map_sql_polars_datatype(inner_type)?)) - } + SQLDataType::Array(inner_type) => match inner_type { + Some(inner_type) => DataType::List(Box::new(map_sql_polars_datatype(inner_type)?)), + None => { + return Err(PolarsError::ComputeError( + "SQL Datatype Array(None) was not supported in polars-sql yet!".into(), + )) + } + }, _ => { return Err(PolarsError::ComputeError( format!(