feat(duckdb): Add transpilation support for positoinal column refs over values#7752
Closed
fivetran-amrutabhimsenayachit wants to merge 1 commit into
Closed
Conversation
6bc6c2d to
be9961d
Compare
Contributor
SQLGlot Integration Test Results✅ All tests passedComparing:
Overallmain: 192441 total, 153536 passed (pass rate: 79.8%) sqlglot:RD-1205932-transpile-bug-positional-column-ref-over-values: 186070 total, 148214 passed (pass rate: 79.7%) Transitions: Dialect pair changes: 0 previous results not found, 2 current results not found ✅ All tests passed |
Collaborator
|
Discussed in Slack/Jira: this is a more general issue with positional column refs which is not easy to transpile to DuckDB without invasive changes with considerable overhead. Closing for now to avoid the complexity overhead in hot methods such as |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue: Snowflake uses
$Nto reference the Nth column of aVALUESclause (e.g.v1.$2). DuckDB also uses$Nbut for prepared-statement parameters — so the transpiled SQL would fail at runtime in DuckDB.Fix: Added
column_sqlto DuckDB's generator. When it sees a$Ncolumn reference whose table alias points to aVALUESsource in the same query, it rewrites it to DuckDB's native column name format(col0, col1, ...)— sov1.$2becomesv1.col1.