Added SORTKEY keyword parsing for redshift queries#2261
Open
romanoff wants to merge 2 commits intoapache:mainfrom
Open
Added SORTKEY keyword parsing for redshift queries#2261romanoff wants to merge 2 commits intoapache:mainfrom
romanoff wants to merge 2 commits intoapache:mainfrom
Conversation
iffyio
reviewed
Mar 4, 2026
| column_position, | ||
| } | ||
| } else if self.parse_keyword(Keyword::ALTER) { | ||
| // Redshift: ALTER SORTKEY (column_list) |
Contributor
There was a problem hiding this comment.
Suggested change
| // Redshift: ALTER SORTKEY (column_list) |
Comment on lines
+10270
to
+10275
| if self.parse_keyword(Keyword::SORTKEY) { | ||
| self.expect_token(&Token::LParen)?; | ||
| let columns = self.parse_comma_separated(|p| p.parse_expr())?; | ||
| self.expect_token(&Token::RParen)?; | ||
| return Ok(AlterTableOperation::AlterSortKey { columns }); | ||
| } |
Contributor
There was a problem hiding this comment.
can we pull this out to its own function (the block is already quite big)? we can do something like the following here to make the function self contained
if self.peek(TOKEN::SORT_KEY) {
self.prev_token(); // Put back the `ALTER` keyword
return self.parse_alter_sort_key()
}
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.
Added SORTKEY keyword parsing for redshift queries
Example of query:
Spec:
https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_TABLE_NEW.html
https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_TABLE_AS.html
https://docs.aws.amazon.com/redshift/latest/dg/r_ALTER_TABLE.html