Skip to content

Commit 8bbe421

Browse files
committed
Compat with latest sqlparser
1 parent 28d1dbb commit 8bbe421

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

datafusion/src/sql/planner.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
128128
verbose,
129129
statement,
130130
analyze,
131+
..
131132
} => self.explain_statement_to_plan(*verbose, *analyze, statement),
132133
Statement::Query(query) => self.query_to_plan(query),
133134
Statement::ShowVariable { variable } => self.show_variable_to_plan(variable),
@@ -301,9 +302,9 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
301302
/// Maps the SQL type to the corresponding Arrow `DataType`
302303
fn make_data_type(&self, sql_type: &SQLDataType) -> Result<DataType> {
303304
match sql_type {
304-
SQLDataType::BigInt => Ok(DataType::Int64),
305-
SQLDataType::Int => Ok(DataType::Int32),
306-
SQLDataType::SmallInt => Ok(DataType::Int16),
305+
SQLDataType::BigInt(_) => Ok(DataType::Int64),
306+
SQLDataType::Int(_) => Ok(DataType::Int32),
307+
SQLDataType::SmallInt(_) => Ok(DataType::Int16),
307308
SQLDataType::Char(_) | SQLDataType::Varchar(_) | SQLDataType::Text => {
308309
Ok(DataType::Utf8)
309310
}
@@ -1866,9 +1867,9 @@ fn extract_possible_join_keys(
18661867
pub fn convert_data_type(sql: &SQLDataType) -> Result<DataType> {
18671868
match sql {
18681869
SQLDataType::Boolean => Ok(DataType::Boolean),
1869-
SQLDataType::SmallInt => Ok(DataType::Int16),
1870-
SQLDataType::Int => Ok(DataType::Int32),
1871-
SQLDataType::BigInt => Ok(DataType::Int64),
1870+
SQLDataType::SmallInt(_) => Ok(DataType::Int16),
1871+
SQLDataType::Int(_) => Ok(DataType::Int32),
1872+
SQLDataType::BigInt(_) => Ok(DataType::Int64),
18721873
SQLDataType::Float(_) | SQLDataType::Real => Ok(DataType::Float64),
18731874
SQLDataType::Double => Ok(DataType::Float64),
18741875
SQLDataType::Char(_) | SQLDataType::Varchar(_) => Ok(DataType::Utf8),

datafusion/src/utils.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,12 @@ use arrow::datatypes::{DataType, Field};
2020
use crate::error::{DataFusionError, Result};
2121
use crate::scalar::ScalarValue;
2222

23-
/// Returns the a field access indexed by `name` from a [`DataType::List`] or [`DataType::Dictionnary`].
23+
/// Returns the field access indexed by `key` from a [`DataType::List`] or [`DataType::Dictionnary`].
2424
/// # Error
2525
/// Errors if
2626
/// * the `data_type` is not a Struct or,
2727
/// * there is no field key is not of the required index type
28-
pub fn get_indexed_field<'a>(
29-
data_type: &'a DataType,
30-
key: &ScalarValue,
31-
) -> Result<Field> {
28+
pub fn get_indexed_field(data_type: &DataType, key: &ScalarValue) -> Result<Field> {
3229
match (data_type, key) {
3330
(DataType::Dictionary(ref kt, ref vt), ScalarValue::Utf8(Some(k))) => {
3431
match kt.as_ref() {

0 commit comments

Comments
 (0)