Skip to content

Commit

Permalink
Update sqlparser to 0.24.0 (#3675)
Browse files Browse the repository at this point in the history
* Update sqlparser requirement from 0.23 to 0.24

Updates the requirements on [sqlparser](https://github.com/sqlparser-rs/sqlparser-rs) to permit the latest version.
- [Release notes](https://github.com/sqlparser-rs/sqlparser-rs/releases)
- [Changelog](https://github.com/sqlparser-rs/sqlparser-rs/blob/main/CHANGELOG.md)
- [Commits](sqlparser-rs/sqlparser-rs@v0.23.0...v0.24.0)

---
updated-dependencies:
- dependency-name: sqlparser
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update for sqlparser changes

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
alamb and dependabot[bot] committed Oct 3, 2022
1 parent c9b26cc commit f706902
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion datafusion/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ object_store = { version = "0.5.0", default-features = false, optional = true }
ordered-float = "3.0"
parquet = { version = "23.0.0", default-features = false, optional = true }
pyo3 = { version = "0.17.1", optional = true }
sqlparser = "0.23"
sqlparser = "0.24"
2 changes: 1 addition & 1 deletion datafusion/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pyo3 = { version = "0.17.1", optional = true }
rand = "0.8"
rayon = { version = "1.5", optional = true }
smallvec = { version = "1.6", features = ["union"] }
sqlparser = "0.23"
sqlparser = "0.24"
tempfile = "3"
tokio = { version = "1.0", features = ["macros", "rt", "rt-multi-thread", "sync", "fs", "parking_lot"] }
tokio-stream = "0.1"
Expand Down
2 changes: 1 addition & 1 deletion datafusion/expr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ path = "src/lib.rs"
ahash = { version = "0.8", default-features = false, features = ["runtime-rng"] }
arrow = { version = "23.0.0", default-features = false }
datafusion-common = { path = "../common", version = "12.0.0" }
sqlparser = "0.23"
sqlparser = "0.24"
2 changes: 1 addition & 1 deletion datafusion/sql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ unicode_expressions = []
arrow = { version = "23.0.0", default-features = false }
datafusion-common = { path = "../common", version = "12.0.0" }
datafusion-expr = { path = "../expr", version = "12.0.0" }
sqlparser = "0.23"
sqlparser = "0.24"
17 changes: 10 additions & 7 deletions datafusion/sql/src/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
verbose,
statement,
analyze,
format: _,
describe_alias: _,
} => self.explain_statement_to_plan(verbose, analyze, *statement),
Statement::Query(query) => self.query_to_plan(*query, &mut HashMap::new()),
Expand Down Expand Up @@ -364,7 +365,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
}
// create logical plan & pass backreferencing CTEs
let logical_plan = self.query_to_plan_with_alias(
cte.query,
*cte.query,
Some(cte_name.clone()),
&mut ctes.clone(),
outer_query_schema,
Expand Down Expand Up @@ -1720,22 +1721,22 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
],
}),

SQLExpr::Value(Value::Interval {
SQLExpr::Array(arr) => self.sql_array_literal(arr.elem, schema),

SQLExpr::Interval {
value,
leading_field,
leading_precision,
last_field,
fractional_seconds_precision,
}) => self.sql_interval_to_literal(
} => self.sql_interval_to_expr(
*value,
leading_field,
leading_precision,
last_field,
fractional_seconds_precision,
),

SQLExpr::Array(arr) => self.sql_array_literal(arr.elem, schema),

SQLExpr::Identifier(id) => {
if id.value.starts_with('@') {
// TODO: figure out if ScalarVariables should be insensitive.
Expand Down Expand Up @@ -2325,7 +2326,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
Ok((fun, args))
}

fn sql_interval_to_literal(
fn sql_interval_to_expr(
&self,
value: SQLExpr,
leading_field: Option<DateTimeField>,
Expand Down Expand Up @@ -2697,7 +2698,7 @@ pub fn convert_simple_data_type(sql_type: &SQLDataType) -> Result<DataType> {
SQLDataType::UnsignedBigInt(_) => Ok(DataType::UInt64),
SQLDataType::Float(_) => Ok(DataType::Float32),
SQLDataType::Real => Ok(DataType::Float32),
SQLDataType::Double => Ok(DataType::Float64),
SQLDataType::Double | SQLDataType::DoublePrecision => Ok(DataType::Float64),
SQLDataType::Char(_)
| SQLDataType::Varchar(_)
| SQLDataType::Text
Expand Down Expand Up @@ -2726,6 +2727,8 @@ pub fn convert_simple_data_type(sql_type: &SQLDataType) -> Result<DataType> {
| SQLDataType::Array(_)
| SQLDataType::Enum(_)
| SQLDataType::Set(_)
| SQLDataType::MediumInt(_)
| SQLDataType::UnsignedMediumInt(_)
| SQLDataType::Clob(_) => Err(DataFusionError::NotImplemented(format!(
"Unsupported SQL type {:?}",
sql_type
Expand Down

0 comments on commit f706902

Please sign in to comment.