Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: _,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is the support for explain plan 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 {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intervals are no longer literals (Value) but can have exprs so the AST was updated to match in apache/datafusion-sqlparser-rs#609

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 All @@ -2723,6 +2724,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