Skip to content

Fixed select dollar column from stage for snowflake#2165

Merged
iffyio merged 2 commits intoapache:mainfrom
romanoff:fix_select_dollar_column_from_stage
Feb 14, 2026
Merged

Fixed select dollar column from stage for snowflake#2165
iffyio merged 2 commits intoapache:mainfrom
romanoff:fix_select_dollar_column_from_stage

Conversation

@romanoff
Copy link
Contributor

@romanoff romanoff commented Jan 16, 2026

Fixed this query for snowflake:

SELECT t.$1, t.$2 FROM @mystage1(file_format => 'myformat', pattern => '.*data.*[.]csv.gz') t

Documentation:
https://docs.snowflake.com/en/user-guide/querying-stage#example-1-querying-columns-in-a-csv-file

Specifically t.$1 part didn't work before

let args = if self.consume_token(&Token::LParen) {
Some(self.parse_table_function_args()?)
} else {
None
Copy link
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 test case that doesn't include table function args?

None
};

let alias = self.maybe_parse_table_alias()?;
Copy link
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 test case that doesn't include an alias?

}

/// Parse a Snowflake stage reference as a table factor.
/// Handles syntax like: `@mystage1 (file_format => 'myformat', pattern => '...')`
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we link to the documentation that supports this syntax?

&& self.peek_keyword_with_tokens(Keyword::SEMANTIC_VIEW, &[Token::LParen])
{
self.parse_semantic_view_table_factor()
} else if dialect_of!(self is SnowflakeDialect)
Copy link
Contributor

Choose a reason for hiding this comment

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

If we need a guard for this I think we would instead use a method on the dialect trait (we're moving away from the dialect_of macro for new code). But I think the guard shouldn't be needed in the first place? so that if we see a SELECT * FROM @foo T we can always accept it regardless of dialect?

@romanoff romanoff force-pushed the fix_select_dollar_column_from_stage branch from b267953 to f05eec9 Compare February 13, 2026 22:48
@romanoff
Copy link
Contributor Author

@iffyio Thank you. Updated

Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @romanoff!

@iffyio iffyio added this pull request to the merge queue Feb 14, 2026
Merged via the queue into apache:main with commit 2ea773a Feb 14, 2026
10 checks passed
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