iffyio commented on code in PR #2223:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2223#discussion_r2840859718


##########
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:
   would it make sense to somehow reuse the 
[is_column_alias](https://github.com/romanoff/datafusion-sqlparser-rs/blob/ca092cff70baace15791c79c7e11ff3a80ee97a3/src/dialect/snowflake.rs#L464)
 method for this dialect instead?
   
   Also can we add test cases that cover this behavior?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to