mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-24 08:43:43 +00:00
fix: unnest join constraint with alias parsing for BigQuery dialect (#732)
* fix: unnest join constraint with alias parsing for BigQuery dialect * chore: fix failing tests
This commit is contained in:
parent
650c53dc77
commit
d420001c37
3 changed files with 33 additions and 21 deletions
|
@ -94,6 +94,34 @@ fn parse_table_identifiers() {
|
|||
test_table_ident("abc5.GROUP", vec![Ident::new("abc5"), Ident::new("GROUP")]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_join_constraint_unnest_alias() {
|
||||
assert_eq!(
|
||||
only(
|
||||
bigquery()
|
||||
.verified_only_select("SELECT * FROM t1 JOIN UNNEST(t1.a) AS f ON c1 = c2")
|
||||
.from
|
||||
)
|
||||
.joins,
|
||||
vec![Join {
|
||||
relation: TableFactor::UNNEST {
|
||||
alias: table_alias("f"),
|
||||
array_expr: Box::new(Expr::CompoundIdentifier(vec![
|
||||
Ident::new("t1"),
|
||||
Ident::new("a")
|
||||
])),
|
||||
with_offset: false,
|
||||
with_offset_alias: None
|
||||
},
|
||||
join_operator: JoinOperator::Inner(JoinConstraint::On(Expr::BinaryOp {
|
||||
left: Box::new(Expr::Identifier("c1".into())),
|
||||
op: BinaryOperator::Eq,
|
||||
right: Box::new(Expr::Identifier("c2".into())),
|
||||
})),
|
||||
}]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_trailing_comma() {
|
||||
for (sql, canonical) in [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue