You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "romanoff (via GitHub)" <gi...@apache.org> on 2026/03/03 23:07:12 UTC
Re: [PR] Extended the Snowflake COPY INTO data-load select item parser to support nested semi-structured path traversal [datafusion-sqlparser-rs]
romanoff commented on code in PR #2223:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2223#discussion_r2880948040
##########
src/dialect/snowflake.rs:
##########
@@ -1493,27 +1493,30 @@ fn parse_select_item_for_data_load(
}?;
}
- // try extracting optional element
- match parser.next_token().token {
- Token::Colon => {
- // parse element
- element = Some(Ident::new(match parser.next_token().token {
- Token::Word(w) => Ok(w.value),
- _ => parser.expected("file_col_num", parser.peek_token()),
- }?));
- }
- _ => {
- // element not present move back
- parser.prev_token();
+ // try extracting optional element path (e.g. :UsageMetrics:hh)
+ let mut elements = Vec::new();
+ while parser.next_token().token == Token::Colon {
+ match parser.next_token().token {
+ Token::Word(w) => elements.push(Ident::new(w.value)),
+ _ => return parser.expected("element name", parser.peek_token()),
}
}
+ parser.prev_token();
+ if !elements.is_empty() {
+ element = Some(elements);
+ }
- // as
+ // optional alias: `AS alias` or just `alias` (implicit)
if parser.parse_keyword(Keyword::AS) {
item_as = Some(match parser.next_token().token {
Token::Word(w) => Ok(Ident::new(w.value)),
_ => parser.expected("column item alias", parser.peek_token()),
}?);
+ } else if let Token::Word(w) = parser.peek_token().token {
+ if !RESERVED_FOR_COLUMN_ALIAS.contains(&w.keyword) {
Review Comment:
@iffyio Updated PR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org