-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Update to sqlparser-rs
v0.50.0
#12014
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
65159e1
ff4a430
0e827b9
a88f6b7
e30d950
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -438,7 +438,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { | |||||
} | ||||||
SQLDataType::Bytea => Ok(DataType::Binary), | ||||||
SQLDataType::Interval => Ok(DataType::Interval(IntervalUnit::MonthDayNano)), | ||||||
SQLDataType::Struct(fields) => { | ||||||
SQLDataType::Struct(fields, _) => { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Likewise here I think it would be good to name the field like
Suggested change
So it is easier to understand by reading just the code what is being ignored |
||||||
let fields = fields | ||||||
.iter() | ||||||
.enumerate() | ||||||
|
@@ -513,6 +513,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { | |||||
| SQLDataType::Union(_) | ||||||
| SQLDataType::Nullable(_) | ||||||
| SQLDataType::LowCardinality(_) | ||||||
| SQLDataType::Trigger | ||||||
=> not_impl_err!( | ||||||
"Unsupported SQL type {sql_type:?}" | ||||||
), | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -198,8 +198,8 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { | |
match statement { | ||
Statement::ExplainTable { | ||
describe_alias: DescribeAlias::Describe, // only parse 'DESCRIBE table_name' and not 'EXPLAIN table_name' | ||
hive_format: _, | ||
table_name, | ||
.. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. per comment above, I recommend keeping the fields named explcitly |
||
} => self.describe_table_to_plan(table_name), | ||
Statement::Explain { | ||
verbose, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -268,6 +268,7 @@ pub(crate) fn value_to_string(value: &Value) -> Option<String> { | |
Value::SingleQuotedString(s) => Some(s.to_string()), | ||
Value::DollarQuotedString(s) => Some(s.to_string()), | ||
Value::Number(_, _) | Value::Boolean(_) => Some(value.to_string()), | ||
Value::UnicodeStringLiteral(s) => Some(s.to_string()), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't really understand why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suspect this was not carefully designed and likely is not an intentional oversight There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think what you have here is ok |
||
Value::DoubleQuotedString(_) | ||
| Value::EscapedStringLiteral(_) | ||
| Value::NationalStringLiteral(_) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -848,8 +848,10 @@ SELECT EXTRACT("year" FROM timestamp '2020-09-08T12:00:00+00:00') | |
---- | ||
2020 | ||
|
||
query error | ||
query R | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🥳 🦜 |
||
SELECT EXTRACT('year' FROM timestamp '2020-09-08T12:00:00+00:00') | ||
---- | ||
2020 | ||
|
||
query R | ||
SELECT date_part('QUARTER', CAST('2000-01-01' AS DATE)) | ||
|
@@ -866,8 +868,10 @@ SELECT EXTRACT("quarter" FROM to_timestamp('2020-09-08T12:00:00+00:00')) | |
---- | ||
3 | ||
|
||
query error | ||
query R | ||
SELECT EXTRACT('quarter' FROM to_timestamp('2020-09-08T12:00:00+00:00')) | ||
---- | ||
3 | ||
|
||
query R | ||
SELECT date_part('MONTH', CAST('2000-01-01' AS DATE)) | ||
|
@@ -884,8 +888,10 @@ SELECT EXTRACT("month" FROM to_timestamp('2020-09-08T12:00:00+00:00')) | |
---- | ||
9 | ||
|
||
query error | ||
query R | ||
SELECT EXTRACT('month' FROM to_timestamp('2020-09-08T12:00:00+00:00')) | ||
---- | ||
9 | ||
|
||
query R | ||
SELECT date_part('WEEK', CAST('2003-01-01' AS DATE)) | ||
|
@@ -902,8 +908,10 @@ SELECT EXTRACT("WEEK" FROM to_timestamp('2020-09-08T12:00:00+00:00')) | |
---- | ||
37 | ||
|
||
query error | ||
query R | ||
SELECT EXTRACT('WEEK' FROM to_timestamp('2020-09-08T12:00:00+00:00')) | ||
---- | ||
37 | ||
|
||
query R | ||
SELECT date_part('DAY', CAST('2000-01-01' AS DATE)) | ||
|
@@ -920,8 +928,10 @@ SELECT EXTRACT("day" FROM to_timestamp('2020-09-08T12:00:00+00:00')) | |
---- | ||
8 | ||
|
||
query error | ||
query R | ||
SELECT EXTRACT('day' FROM to_timestamp('2020-09-08T12:00:00+00:00')) | ||
---- | ||
8 | ||
|
||
query R | ||
SELECT date_part('DOY', CAST('2000-01-01' AS DATE)) | ||
|
@@ -938,8 +948,10 @@ SELECT EXTRACT("doy" FROM to_timestamp('2020-09-08T12:00:00+00:00')) | |
---- | ||
252 | ||
|
||
query error | ||
query R | ||
SELECT EXTRACT('doy' FROM to_timestamp('2020-09-08T12:00:00+00:00')) | ||
---- | ||
252 | ||
|
||
query R | ||
SELECT date_part('DOW', CAST('2000-01-01' AS DATE)) | ||
|
@@ -956,8 +968,10 @@ SELECT EXTRACT("dow" FROM to_timestamp('2020-09-08T12:00:00+00:00')) | |
---- | ||
2 | ||
|
||
query error | ||
query R | ||
SELECT EXTRACT('dow' FROM to_timestamp('2020-09-08T12:00:00+00:00')) | ||
---- | ||
2 | ||
|
||
query R | ||
SELECT date_part('HOUR', CAST('2000-01-01' AS DATE)) | ||
|
@@ -974,8 +988,10 @@ SELECT EXTRACT("hour" FROM to_timestamp('2020-09-08T12:03:03+00:00')) | |
---- | ||
12 | ||
|
||
query error | ||
query R | ||
SELECT EXTRACT('hour' FROM to_timestamp('2020-09-08T12:03:03+00:00')) | ||
---- | ||
12 | ||
|
||
query R | ||
SELECT EXTRACT(minute FROM to_timestamp('2020-09-08T12:12:00+00:00')) | ||
|
@@ -987,8 +1003,10 @@ SELECT EXTRACT("minute" FROM to_timestamp('2020-09-08T12:12:00+00:00')) | |
---- | ||
12 | ||
|
||
query error | ||
query R | ||
SELECT EXTRACT('minute' FROM to_timestamp('2020-09-08T12:12:00+00:00')) | ||
---- | ||
12 | ||
|
||
query R | ||
SELECT date_part('minute', to_timestamp('2020-09-08T12:12:00+00:00')) | ||
|
@@ -1035,17 +1053,25 @@ SELECT EXTRACT("nanosecond" FROM timestamp '2020-09-08T12:00:12.12345678+00:00') | |
---- | ||
12123456780 | ||
|
||
query error | ||
query R | ||
SELECT EXTRACT('second' FROM timestamp '2020-09-08T12:00:12.12345678+00:00') | ||
---- | ||
12.12345678 | ||
|
||
query error | ||
query R | ||
SELECT EXTRACT('millisecond' FROM timestamp '2020-09-08T12:00:12.12345678+00:00') | ||
---- | ||
12123.45678 | ||
|
||
query error | ||
query R | ||
SELECT EXTRACT('microsecond' FROM timestamp '2020-09-08T12:00:12.12345678+00:00') | ||
---- | ||
12123456.78 | ||
|
||
query error | ||
query R | ||
SELECT EXTRACT('nanosecond' FROM timestamp '2020-09-08T12:00:12.12345678+00:00') | ||
---- | ||
12123456780 | ||
|
||
# Keep precision when coercing Utf8 to Timestamp | ||
query R | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend explicitly listing out the other fields here and returning a NotImplemented error if there is some new syntax that DataFusion doesn't support.
Otherwise what we have seen a few times in the past is that the parser accepts some new syntax element but DataFusion just igores it silently