Skip to content
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

feat: Add CrossJoin match case to unparser #10371

Merged
merged 2 commits into from
May 5, 2024
Merged

feat: Add CrossJoin match case to unparser #10371

merged 2 commits into from
May 5, 2024

Conversation

sardination
Copy link
Contributor

@sardination sardination commented May 3, 2024

Which issue does this PR close?

Part of #8661

Rationale for this change

Came across this issue when trying to federate a query selecting from multiple tables with different sources. For example, SELECT a_1, b_1 FROM table_a, table_b is evaluated as a cross join, but the unparser wasn't handling cross joins yet.

What changes are included in this PR?

Allow unparsing of cross joins into the equivalent inner join.

Are these changes tested?

Added a test for cross join roundtrip. It is slightly different from the other roundtrips because sqlparser doesn't have an implementation for Cross Join, so it gets converted into an Inner Join.

Are there any user-facing changes?

@github-actions github-actions bot added the sql SQL Planner label May 3, 2024
@alamb
Copy link
Contributor

alamb commented May 3, 2024

CI failure seems to be infrastructure related: https://github.com/apache/datafusion/actions/runs/8943389816/job/24568207362?pr=10371 -- I restarted it

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me -- thank you @sardination

cc @devinjdangelo @backkem

let sql_to_rel = SqlToRel::new(&context);
let plan = sql_to_rel.sql_statement_to_plan(statement).unwrap();

let roundtrip_statement = plan_to_sql(&plan)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@alamb alamb merged commit ca5fb7d into apache:main May 5, 2024
24 checks passed
@alamb
Copy link
Contributor

alamb commented May 5, 2024

Thanks again @sardination !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants