mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-27 17:34:05 +00:00
Properly handle mixed implicit and explicit joins
Parse a query like SELECT * FROM a NATURAL JOIN b, c NATURAL JOIN d as the SQL specification requires, i.e.: from: [ TableReference { relation: TableFactor::Table("a"), joins: [Join { relation: TableFactor::Table("b"), join_operator: JoinOperator::Natural, }] }, TableReference { relation: TableFactor::Table("c"), joins: [Join { relation: TableFactor::Table("d"), join_operator: JoinOperator::Natural, }] } ] Previously we were parsing such queries as relation: TableFactor::Table("a"), joins: [ Join { relation: TableFactor::Table("b"), join_operator: JoinOperator::Natural, }, Join { relation: TableFactor::Table("c"), join_operator: JoinOperator::Implicit, }, Join { relation: TableFactor::Table("d"), join_operator: JoinOperator::Natural, }, ] which did not make the join hierarchy clear.
This commit is contained in:
parent
518c8833d2
commit
b841dccc2c
6 changed files with 219 additions and 164 deletions
|
@ -19,8 +19,8 @@ fn parse_mssql_identifiers() {
|
|||
expr_from_projection(&select.projection[1]),
|
||||
);
|
||||
assert_eq!(2, select.projection.len());
|
||||
match select.relation {
|
||||
Some(TableFactor::Table { name, .. }) => {
|
||||
match &only(&select.from).relation {
|
||||
TableFactor::Table { name, .. } => {
|
||||
assert_eq!("##temp".to_string(), name.to_string());
|
||||
}
|
||||
_ => unreachable!(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue