feat(duckdb): Fix and updates tests for pivot subquery string lietral column names#7757
Merged
georgesittas merged 2 commits intoJun 18, 2026
Conversation
Contributor
SQLGlot Integration Test Results✅ All tests passedComparing:
Overallmain: 192441 total, 153536 passed (pass rate: 79.8%) sqlglot:RD-1205936-transpile-bug-pivot-subquery-string-literal-column-names: 180247 total, 142391 passed (pass rate: 79.0%) Transitions: Dialect pair changes: 0 previous results not found, 3 current results not found ✅ All tests passed |
302d2dd to
9f87c68
Compare
Collaborator
|
@fivetran-amrutabhimsenayachit did you check the test failures? |
9f87c68 to
c8d4222
Compare
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.
Problem
Transpiling a Snowflake PIVOT query with string literal IN-values (e.g.
IN ('JAN', 'FEB'))on a subquery source failed in DuckDB with zero-length delimited identifier after the optimizer ran.Two compounding root causes:
The Snowflake parser stored pivot column names with surrounding apostrophes (
'JAN'stored as identifier"'JAN'"), because it used fld.sql() instead of fld.alias_or_name. This propagated through qualify_columns star-expansion into column references like""."'JAN'"— the 'JAN'part was invalid, and the "" empty table qualifier (cause #2) was also rejected.When the pivot sat on a subquery with no alias, pivot.alias was '', so
exp.column(name, table='')generated a zero-length delimited identifier "" as the table qualifier, which DuckDB rejects outright.