mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-04 14:28:22 +00:00
Implement Spanned
to retrieve source locations on AST nodes (#1435)
Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com> Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
parent
0adec33b94
commit
3c8fd74804
18 changed files with 3092 additions and 399 deletions
|
@ -23,6 +23,7 @@ use std::ops::Deref;
|
|||
use sqlparser::ast::*;
|
||||
use sqlparser::dialect::{BigQueryDialect, GenericDialect};
|
||||
use sqlparser::parser::{ParserError, ParserOptions};
|
||||
use sqlparser::tokenizer::Span;
|
||||
use test_utils::*;
|
||||
|
||||
#[test]
|
||||
|
@ -678,10 +679,12 @@ fn parse_typed_struct_syntax_bigquery() {
|
|||
Ident {
|
||||
value: "t".into(),
|
||||
quote_style: None,
|
||||
span: Span::empty(),
|
||||
},
|
||||
Ident {
|
||||
value: "str_col".into(),
|
||||
quote_style: None,
|
||||
span: Span::empty(),
|
||||
},
|
||||
]),
|
||||
],
|
||||
|
@ -690,6 +693,7 @@ fn parse_typed_struct_syntax_bigquery() {
|
|||
field_name: Some(Ident {
|
||||
value: "x".into(),
|
||||
quote_style: None,
|
||||
span: Span::empty(),
|
||||
}),
|
||||
field_type: DataType::Int64
|
||||
},
|
||||
|
@ -697,6 +701,7 @@ fn parse_typed_struct_syntax_bigquery() {
|
|||
field_name: Some(Ident {
|
||||
value: "y".into(),
|
||||
quote_style: None,
|
||||
span: Span::empty(),
|
||||
}),
|
||||
field_type: DataType::String(None)
|
||||
},
|
||||
|
@ -709,6 +714,7 @@ fn parse_typed_struct_syntax_bigquery() {
|
|||
values: vec![Expr::Identifier(Ident {
|
||||
value: "nested_col".into(),
|
||||
quote_style: None,
|
||||
span: Span::empty(),
|
||||
}),],
|
||||
fields: vec![
|
||||
StructField {
|
||||
|
@ -740,6 +746,7 @@ fn parse_typed_struct_syntax_bigquery() {
|
|||
values: vec![Expr::Identifier(Ident {
|
||||
value: "nested_col".into(),
|
||||
quote_style: None,
|
||||
span: Span::empty(),
|
||||
}),],
|
||||
fields: vec![
|
||||
StructField {
|
||||
|
@ -987,10 +994,12 @@ fn parse_typed_struct_syntax_bigquery_and_generic() {
|
|||
Ident {
|
||||
value: "t".into(),
|
||||
quote_style: None,
|
||||
span: Span::empty(),
|
||||
},
|
||||
Ident {
|
||||
value: "str_col".into(),
|
||||
quote_style: None,
|
||||
span: Span::empty(),
|
||||
},
|
||||
]),
|
||||
],
|
||||
|
@ -999,6 +1008,7 @@ fn parse_typed_struct_syntax_bigquery_and_generic() {
|
|||
field_name: Some(Ident {
|
||||
value: "x".into(),
|
||||
quote_style: None,
|
||||
span: Span::empty(),
|
||||
}),
|
||||
field_type: DataType::Int64
|
||||
},
|
||||
|
@ -1006,6 +1016,7 @@ fn parse_typed_struct_syntax_bigquery_and_generic() {
|
|||
field_name: Some(Ident {
|
||||
value: "y".into(),
|
||||
quote_style: None,
|
||||
span: Span::empty(),
|
||||
}),
|
||||
field_type: DataType::String(None)
|
||||
},
|
||||
|
@ -1018,6 +1029,7 @@ fn parse_typed_struct_syntax_bigquery_and_generic() {
|
|||
values: vec![Expr::Identifier(Ident {
|
||||
value: "nested_col".into(),
|
||||
quote_style: None,
|
||||
span: Span::empty(),
|
||||
}),],
|
||||
fields: vec![
|
||||
StructField {
|
||||
|
@ -1049,6 +1061,7 @@ fn parse_typed_struct_syntax_bigquery_and_generic() {
|
|||
values: vec![Expr::Identifier(Ident {
|
||||
value: "nested_col".into(),
|
||||
quote_style: None,
|
||||
span: Span::empty(),
|
||||
}),],
|
||||
fields: vec![
|
||||
StructField {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue