Skip to content

Redshift: PartiQL AT <index>#2303

Open
yoavcloud wants to merge 2 commits intoapache:mainfrom
yoavcloud:redshift_partiql_at
Open

Redshift: PartiQL AT <index>#2303
yoavcloud wants to merge 2 commits intoapache:mainfrom
yoavcloud:redshift_partiql_at

Conversation

@yoavcloud
Copy link
Copy Markdown
Contributor

Add support for the AT keyword in PartiQL that is used during unnesting to retrieve the index of an element in an array.

For example:

SELECT index, val FROM my_table t, t.my_array val AT index;

Comment thread src/ast/query.rs
Comment on lines +2530 to +2531
/// Optional PartiQL index alias declared with `AT`.
pub at: Option<Ident>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we add a link to the doc defining the syntax? (maybe an example syntax would also be helpful like we have on the explicit field)


#[test]
fn test_partiql_from_alias_with_at_index() {
redshift().verified_stmt("SELECT * FROM lineitem AS l (a, b, c) AT idx");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

for the test can we switch to all_dialect_where(|d| d.supports_partiql()) so that future dialects are covered without duplicating tests?

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