You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2021/09/26 10:48:19 UTC

[arrow-datafusion] branch master updated: Update sqlparser-rs to 0.11 (#1052)

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

alamb 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 6da0b91   Update sqlparser-rs to 0.11 (#1052)
6da0b91 is described below

commit 6da0b91041a462772219de6bed37f2054db114f6
Author: Andrew Lamb <an...@nerdnetworks.org>
AuthorDate: Sun Sep 26 06:48:15 2021 -0400

     Update sqlparser-rs to 0.11 (#1052)
    
    * Update sqlparser-rs to 0.11
    
    * Update code to handle optional display
---
 ballista/rust/core/Cargo.toml |  2 +-
 datafusion/Cargo.toml         |  2 +-
 datafusion/src/sql/parser.rs  |  3 ++-
 datafusion/src/sql/planner.rs | 13 +++++++------
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/ballista/rust/core/Cargo.toml b/ballista/rust/core/Cargo.toml
index 29a0f09..94ee71d 100644
--- a/ballista/rust/core/Cargo.toml
+++ b/ballista/rust/core/Cargo.toml
@@ -37,7 +37,7 @@ hashbrown = "0.11"
 log = "0.4"
 prost = "0.8"
 serde = {version = "1", features = ["derive"]}
-sqlparser = "0.10.0"
+sqlparser = "0.11.0"
 tokio = "1.0"
 tonic = "0.5"
 uuid = { version = "0.8", features = ["v4"] }
diff --git a/datafusion/Cargo.toml b/datafusion/Cargo.toml
index c1998be..327fcd3 100644
--- a/datafusion/Cargo.toml
+++ b/datafusion/Cargo.toml
@@ -52,7 +52,7 @@ ahash = "0.7"
 hashbrown = { version = "0.11", features = ["raw"] }
 arrow = { version = "^5.3", features = ["prettyprint"] }
 parquet = { version = "^5.3", features = ["arrow"] }
-sqlparser = "0.10"
+sqlparser = "0.11"
 paste = "^1.0"
 num_cpus = "1.13.0"
 chrono = "0.4"
diff --git a/datafusion/src/sql/parser.rs b/datafusion/src/sql/parser.rs
index 864801c..c4822c8 100644
--- a/datafusion/src/sql/parser.rs
+++ b/datafusion/src/sql/parser.rs
@@ -362,9 +362,10 @@ mod tests {
     fn create_external_table() -> Result<(), ParserError> {
         // positive case
         let sql = "CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV LOCATION 'foo.csv'";
+        let display = None;
         let expected = Statement::CreateExternalTable(CreateExternalTable {
             name: "t".into(),
-            columns: vec![make_column_def("c1", DataType::Int)],
+            columns: vec![make_column_def("c1", DataType::Int(display))],
             file_type: FileType::CSV,
             has_header: false,
             location: "foo.csv".into(),
diff --git a/datafusion/src/sql/planner.rs b/datafusion/src/sql/planner.rs
index f3d1e9e..d969a1f 100644
--- a/datafusion/src/sql/planner.rs
+++ b/datafusion/src/sql/planner.rs
@@ -102,6 +102,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
                 verbose,
                 statement,
                 analyze,
+                describe_alias: _,
             } => self.explain_statement_to_plan(*verbose, *analyze, statement),
             Statement::Query(query) => self.query_to_plan(query),
             Statement::ShowVariable { variable } => self.show_variable_to_plan(variable),
@@ -275,9 +276,9 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
     /// Maps the SQL type to the corresponding Arrow `DataType`
     fn make_data_type(&self, sql_type: &SQLDataType) -> Result<DataType> {
         match sql_type {
-            SQLDataType::BigInt => Ok(DataType::Int64),
-            SQLDataType::Int => Ok(DataType::Int32),
-            SQLDataType::SmallInt => Ok(DataType::Int16),
+            SQLDataType::BigInt(_display) => Ok(DataType::Int64),
+            SQLDataType::Int(_display) => Ok(DataType::Int32),
+            SQLDataType::SmallInt(_display) => Ok(DataType::Int16),
             SQLDataType::Char(_) | SQLDataType::Varchar(_) | SQLDataType::Text => {
                 Ok(DataType::Utf8)
             }
@@ -1829,9 +1830,9 @@ fn extract_possible_join_keys(
 pub fn convert_data_type(sql: &SQLDataType) -> Result<DataType> {
     match sql {
         SQLDataType::Boolean => Ok(DataType::Boolean),
-        SQLDataType::SmallInt => Ok(DataType::Int16),
-        SQLDataType::Int => Ok(DataType::Int32),
-        SQLDataType::BigInt => Ok(DataType::Int64),
+        SQLDataType::SmallInt(_display) => Ok(DataType::Int16),
+        SQLDataType::Int(_display) => Ok(DataType::Int32),
+        SQLDataType::BigInt(_display) => Ok(DataType::Int64),
         SQLDataType::Float(_) | SQLDataType::Real => Ok(DataType::Float64),
         SQLDataType::Double => Ok(DataType::Float64),
         SQLDataType::Char(_) | SQLDataType::Varchar(_) => Ok(DataType::Utf8),