Fix Redshift parenthesized single-column SORTKEY and DISTKEY - #5915
Open
simen-strand wants to merge 6 commits into
Open
simen-strand wants to merge 6 commits into
simen-strand wants to merge 6 commits into
Conversation
Signed-off-by: Simen Strand <simen.strand@netcheck.de>
Parametrize the model-definition test over bare, quoted, parenthesized single-column, tuple, and array sortkey values, restoring coverage for the bare single-column form. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Simen Strand <simen.strand@netcheck.de>
Contributor
Author
|
@StuffbyYuki could you take a look? This small PR makes the Redshift sortkey property accept the documented |
StuffbyYuki
self-requested a review
October 2, 2026 07:01
StuffbyYuki
approved these changes
Oct 2, 2026
StuffbyYuki
left a comment
Collaborator
There was a problem hiding this comment.
@simen-strand A suggestion - DISTKEY has the same bug: distkey = (col) still renders as DISTKEY((col)). Maybe consider unwrapping parentheses there too (e.g. .unnest() before _to_identifier_if_string) and adding a test case, so the two properties behave the same way?
A parenthesized distkey such as `distkey = (col)` rendered as `DISTKEY((col))`, which doesn't match Redshift's documented `DISTKEY ( column_name )` syntax. Unwrap the parentheses the same way the sortkey handling does, and test the bare, quoted, string and parenthesized forms in model physical_properties. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Simen Strand <simen.strand@netcheck.de>
Contributor
Author
|
Thanks @StuffbyYuki, you're right about the DISTKEY bug, I added the fix here. |
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.
Description
Redshift: adds support for parenthesized single-column
sortkeyanddistkey.SQLGlot parses
sortkey = (column)anddistkey = (column)as anexp.Paren, producing invalid Redshift syntax such asSORTKEY((column))/DISTKEY((column)).SortKeyProperty.DistKeyProperty, matching Redshift's documentedDISTKEY ( column_name )syntax (single column only).Tests
sortkeyform a user can write.distkeyforms.pytest tests/core/engine_adapter/test_redshift.py(47 passed) andmake fast-test(190 passed).Checklist
make styleand fixed any issuesmake fast-test)git commit -s) per the DCO🤖 Generated with Claude Code