Skip to content

Commit

Permalink
bump sql-parser 0.25 (#3698)
Browse files Browse the repository at this point in the history
* bump sql-parser 0.25

* Revert update to `parquet-testing` and `testing` sub modules

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
  • Loading branch information
xudong963 and alamb authored Oct 4, 2022
1 parent 5731228 commit a07bebc
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 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 = "24.0.0", default-features = false, optional = true }
pyo3 = { version = "0.17.1", optional = true }
sqlparser = "0.24"
sqlparser = "0.25"
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.24"
sqlparser = "0.25"
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 = "24.0.0", default-features = false }
datafusion-common = { path = "../common", version = "12.0.0" }
sqlparser = "0.24"
sqlparser = "0.25"
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 = "24.0.0", default-features = false }
datafusion-common = { path = "../common", version = "12.0.0" }
datafusion-expr = { path = "../expr", version = "12.0.0" }
sqlparser = "0.24"
sqlparser = "0.25"
21 changes: 13 additions & 8 deletions datafusion/sql/src/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ use sqlparser::ast::{
BinaryOperator, DataType as SQLDataType, DateTimeField, Expr as SQLExpr, FunctionArg,
FunctionArgExpr, Ident, Join, JoinConstraint, JoinOperator, ObjectName,
Offset as SQLOffset, Query, Select, SelectItem, SetExpr, SetOperator,
ShowCreateObject, ShowStatementFilter, TableFactor, TableWithJoins, TrimWhereField,
UnaryOperator, Value, Values as SQLValues,
ShowCreateObject, ShowStatementFilter, TableFactor, TableWithJoins, TimezoneInfo,
TrimWhereField, UnaryOperator, Value, Values as SQLValues,
};
use sqlparser::ast::{ColumnDef as SQLColumnDef, ColumnOption};
use sqlparser::ast::{ObjectType, OrderByExpr, Statement};
Expand Down Expand Up @@ -2703,13 +2703,18 @@ pub fn convert_simple_data_type(sql_type: &SQLDataType) -> Result<DataType> {
| SQLDataType::Varchar(_)
| SQLDataType::Text
| SQLDataType::String => Ok(DataType::Utf8),
SQLDataType::Timestamp => Ok(DataType::Timestamp(TimeUnit::Nanosecond, None)),
SQLDataType::TimestampTz => Ok(DataType::Timestamp(
TimeUnit::Nanosecond,
Some("UTC".into()),
)),
SQLDataType::Timestamp(tz_info) => {
let tz = if matches!(tz_info, TimezoneInfo::Tz)
|| matches!(tz_info, TimezoneInfo::WithTimeZone)
{
Some("UTC".to_string())
} else {
None
};
Ok(DataType::Timestamp(TimeUnit::Nanosecond, tz))
}
SQLDataType::Date => Ok(DataType::Date32),
SQLDataType::Time => Ok(DataType::Time64(TimeUnit::Nanosecond)),
SQLDataType::Time(_) => Ok(DataType::Time64(TimeUnit::Nanosecond)),
SQLDataType::Decimal(precision, scale) => make_decimal_type(*precision, *scale),
SQLDataType::Bytea => Ok(DataType::Binary),
// Explicitly list all other types so that if sqlparser
Expand Down

0 comments on commit a07bebc

Please sign in to comment.