This is an automated email from the ASF dual-hosted git repository.

xudong963 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new a07bebcb6 bump sql-parser 0.25 (#3698)
a07bebcb6 is described below

commit a07bebcb6c6c23cf5b42a67cacbfd699cc6f2e13
Author: xudong.w <[email protected]>
AuthorDate: Tue Oct 4 22:30:38 2022 +0800

    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]>
---
 datafusion/common/Cargo.toml  |  2 +-
 datafusion/core/Cargo.toml    |  2 +-
 datafusion/expr/Cargo.toml    |  2 +-
 datafusion/sql/Cargo.toml     |  2 +-
 datafusion/sql/src/planner.rs | 21 +++++++++++++--------
 5 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/datafusion/common/Cargo.toml b/datafusion/common/Cargo.toml
index 994c39bef..51529ccc7 100644
--- a/datafusion/common/Cargo.toml
+++ b/datafusion/common/Cargo.toml
@@ -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"
diff --git a/datafusion/core/Cargo.toml b/datafusion/core/Cargo.toml
index 8c275e4da..1ba9f769f 100644
--- a/datafusion/core/Cargo.toml
+++ b/datafusion/core/Cargo.toml
@@ -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"
diff --git a/datafusion/expr/Cargo.toml b/datafusion/expr/Cargo.toml
index a3111517e..1d466264e 100644
--- a/datafusion/expr/Cargo.toml
+++ b/datafusion/expr/Cargo.toml
@@ -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"
diff --git a/datafusion/sql/Cargo.toml b/datafusion/sql/Cargo.toml
index 55aabd48c..47cf6e8ac 100644
--- a/datafusion/sql/Cargo.toml
+++ b/datafusion/sql/Cargo.toml
@@ -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"
diff --git a/datafusion/sql/src/planner.rs b/datafusion/sql/src/planner.rs
index 77e77444c..ef57be27f 100644
--- a/datafusion/sql/src/planner.rs
+++ b/datafusion/sql/src/planner.rs
@@ -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};
@@ -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

Reply via email to