Skip to content

[BSE-4250] Infrastructure for converting Relational to SQL #65

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

Merged
merged 257 commits into from
Nov 21, 2024

Conversation

njriasan
Copy link
Contributor

Adds the basic support for converting relational to SQL. This is a simple test for the most basic functionality + API. The followup PR will add tests for every type of operator.

@njriasan njriasan changed the title [BSE-4250] Support converting Relational to SQL [BSE-4250] Infrastructure for converting Relational to SQL Nov 20, 2024
Copy link
Contributor

@knassre-bodo knassre-bodo left a comment

Choose a reason for hiding this comment

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

One big note, but I'll leave it to your judgement on how to address it.

input=build_simple_scan(),
ordered_columns=[("b", make_relational_column_reference("b"))],
),
"SELECT b FROM table",
Copy link
Contributor

Choose a reason for hiding this comment

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

🥳 🥳 🥳 🥳 🥳 🥳 🥳

Comment on lines 16 to 17
# Cache a visitor for the module
_visitor: SQLGlotRelationalVisitor = SQLGlotRelationalVisitor()
Copy link
Contributor

Choose a reason for hiding this comment

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

I advise against having a single defined visitor. When we get around to redefining how function translation works, the binding setup will likely be dialect-dependant, and each visitor will accordingly need its own bindings based on the dialect (or even on any functions the user defines in context). For the sake of flexibility, I advise we instead define some kind of datastructure that can host multiple visitors, at minimum broken up by dialect. For now, we'll only ever create & use one of them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I can move it out here since this is an over optimization.

Base automatically changed from nick/anti_semi_join_support to main November 21, 2024 02:31
@njriasan njriasan merged commit acd37c1 into main Nov 21, 2024
4 checks passed
@njriasan njriasan deleted the nick/relational_to_sql branch November 21, 2024 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants