Skip to content

Commit a07bebc

Browse files
xudong963alamb
andauthored
bump sql-parser 0.25 (#3698)
* bump sql-parser 0.25 * Revert update to `parquet-testing` and `testing` sub modules Co-authored-by: Andrew Lamb <[email protected]>
1 parent 5731228 commit a07bebc

5 files changed

Lines changed: 17 additions & 12 deletions

File tree

‎datafusion/common/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ object_store = { version = "0.5.0", default-features = false, optional = true }
4646
ordered-float = "3.0"
4747
parquet = { version = "24.0.0", default-features = false, optional = true }
4848
pyo3 = { version = "0.17.1", optional = true }
49-
sqlparser = "0.24"
49+
sqlparser = "0.25"

‎datafusion/core/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pyo3 = { version = "0.17.1", optional = true }
8585
rand = "0.8"
8686
rayon = { version = "1.5", optional = true }
8787
smallvec = { version = "1.6", features = ["union"] }
88-
sqlparser = "0.24"
88+
sqlparser = "0.25"
8989
tempfile = "3"
9090
tokio = { version = "1.0", features = ["macros", "rt", "rt-multi-thread", "sync", "fs", "parking_lot"] }
9191
tokio-stream = "0.1"

‎datafusion/expr/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ path = "src/lib.rs"
3838
ahash = { version = "0.8", default-features = false, features = ["runtime-rng"] }
3939
arrow = { version = "24.0.0", default-features = false }
4040
datafusion-common = { path = "../common", version = "12.0.0" }
41-
sqlparser = "0.24"
41+
sqlparser = "0.25"

‎datafusion/sql/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ unicode_expressions = []
4040
arrow = { version = "24.0.0", default-features = false }
4141
datafusion-common = { path = "../common", version = "12.0.0" }
4242
datafusion-expr = { path = "../expr", version = "12.0.0" }
43-
sqlparser = "0.24"
43+
sqlparser = "0.25"

‎datafusion/sql/src/planner.rs‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ use sqlparser::ast::{
5959
BinaryOperator, DataType as SQLDataType, DateTimeField, Expr as SQLExpr, FunctionArg,
6060
FunctionArgExpr, Ident, Join, JoinConstraint, JoinOperator, ObjectName,
6161
Offset as SQLOffset, Query, Select, SelectItem, SetExpr, SetOperator,
62-
ShowCreateObject, ShowStatementFilter, TableFactor, TableWithJoins, TrimWhereField,
63-
UnaryOperator, Value, Values as SQLValues,
62+
ShowCreateObject, ShowStatementFilter, TableFactor, TableWithJoins, TimezoneInfo,
63+
TrimWhereField, UnaryOperator, Value, Values as SQLValues,
6464
};
6565
use sqlparser::ast::{ColumnDef as SQLColumnDef, ColumnOption};
6666
use sqlparser::ast::{ObjectType, OrderByExpr, Statement};
@@ -2703,13 +2703,18 @@ pub fn convert_simple_data_type(sql_type: &SQLDataType) -> Result<DataType> {
27032703
| SQLDataType::Varchar(_)
27042704
| SQLDataType::Text
27052705
| SQLDataType::String => Ok(DataType::Utf8),
2706-
SQLDataType::Timestamp => Ok(DataType::Timestamp(TimeUnit::Nanosecond, None)),
2707-
SQLDataType::TimestampTz => Ok(DataType::Timestamp(
2708-
TimeUnit::Nanosecond,
2709-
Some("UTC".into()),
2710-
)),
2706+
SQLDataType::Timestamp(tz_info) => {
2707+
let tz = if matches!(tz_info, TimezoneInfo::Tz)
2708+
|| matches!(tz_info, TimezoneInfo::WithTimeZone)
2709+
{
2710+
Some("UTC".to_string())
2711+
} else {
2712+
None
2713+
};
2714+
Ok(DataType::Timestamp(TimeUnit::Nanosecond, tz))
2715+
}
27112716
SQLDataType::Date => Ok(DataType::Date32),
2712-
SQLDataType::Time => Ok(DataType::Time64(TimeUnit::Nanosecond)),
2717+
SQLDataType::Time(_) => Ok(DataType::Time64(TimeUnit::Nanosecond)),
27132718
SQLDataType::Decimal(precision, scale) => make_decimal_type(*precision, *scale),
27142719
SQLDataType::Bytea => Ok(DataType::Binary),
27152720
// Explicitly list all other types so that if sqlparser

0 commit comments

Comments
 (0)