update sqlparser dependency (#7772)

# Description

This PR updates the `sqlparser` dependency and updates code to the
latest api changes.

# User-Facing Changes


# Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
- `cargo test --workspace` to check that all tests pass

# After Submitting

If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
This commit is contained in:
Darren Schroeder 2023-01-15 21:30:39 -06:00 committed by GitHub
parent 5979e0cd0c
commit 26e6516626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 9 deletions

4
Cargo.lock generated
View File

@ -4825,9 +4825,9 @@ dependencies = [
[[package]] [[package]]
name = "sqlparser" name = "sqlparser"
version = "0.23.0" version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0beb13adabbdda01b63d595f38c8bfd19a361e697fd94ce0098a634077bc5b25" checksum = "db67dc6ef36edb658196c3fef0464a80b53dbbc194a904e81f9bd4190f9ecc5b"
dependencies = [ dependencies = [
"log", "log",
"serde", "serde",

View File

@ -100,7 +100,7 @@ which = { version = "4.3.0", optional = true }
reedline = { version = "0.14.0", features = ["bashisms", "sqlite"] } reedline = { version = "0.14.0", features = ["bashisms", "sqlite"] }
wax = { version = "0.5.0" } wax = { version = "0.5.0" }
rusqlite = { version = "0.28.0", features = ["bundled"], optional = true } 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] [target.'cfg(windows)'.dependencies]
winreg = "0.10.1" winreg = "0.10.1"

View File

@ -85,7 +85,7 @@ impl SQLContext {
raw_projection_before_alias.insert(format!("{:?}", expr), i); raw_projection_before_alias.insert(format!("{:?}", expr), i);
expr.alias(&alias.value) expr.alias(&alias.value)
} }
SelectItem::QualifiedWildcard(_) | SelectItem::Wildcard => { SelectItem::QualifiedWildcard(_, _) | SelectItem::Wildcard(_) => {
contain_wildcard = true; contain_wildcard = true;
col("*") col("*")
} }

View File

@ -28,12 +28,17 @@ fn map_sql_polars_datatype(data_type: &SQLDataType) -> Result<DataType> {
SQLDataType::Boolean => DataType::Boolean, SQLDataType::Boolean => DataType::Boolean,
SQLDataType::Date => DataType::Date, SQLDataType::Date => DataType::Date,
SQLDataType::Time => DataType::Time, SQLDataType::Time(_, _) => DataType::Time,
SQLDataType::Timestamp => DataType::Datetime(TimeUnit::Milliseconds, None), SQLDataType::Timestamp(_, _) => DataType::Datetime(TimeUnit::Milliseconds, None),
SQLDataType::Interval => DataType::Duration(TimeUnit::Milliseconds), SQLDataType::Interval => DataType::Duration(TimeUnit::Milliseconds),
SQLDataType::Array(inner_type) => { SQLDataType::Array(inner_type) => match inner_type {
DataType::List(Box::new(map_sql_polars_datatype(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( return Err(PolarsError::ComputeError(
format!( format!(