Snowflake COPY INTO: support nested semi-structured path #2223
Snowflake COPY INTO: support nested semi-structured path #2223romanoff wants to merge 3 commits into
COPY INTO: support nested semi-structured path #2223Conversation
| } else if let Token::Word(w) = parser.peek_token().token { | ||
| if !RESERVED_FOR_COLUMN_ALIAS.contains(&w.keyword) { |
There was a problem hiding this comment.
would it make sense to somehow reuse the is_column_alias method for this dialect instead?
Also can we add test cases that cover this behavior?
ca092cf to
6dccdeb
Compare
|
|
||
| /// Optionally parses an alias for a select list item | ||
| fn maybe_parse_select_item_alias(&mut self) -> Result<Option<Ident>, ParserError> { | ||
| pub fn maybe_parse_select_item_alias(&mut self) -> Result<Option<Ident>, ParserError> { |
There was a problem hiding this comment.
| pub fn maybe_parse_select_item_alias(&mut self) -> Result<Option<Ident>, ParserError> { | |
| pub(crate) fn maybe_parse_select_item_alias(&mut self) -> Result<Option<Ident>, ParserError> { |
| Token::Word(w) => Ok(Ident::new(w.value)), | ||
| _ => parser.expected_ref("column item alias", parser.peek_token_ref()), | ||
| }?); | ||
| parser.prev_token(); |
There was a problem hiding this comment.
would it be possible to rewrite the code so that it peeks the expected Token::Colon before entering the loop? if that would let us avoid this call to prev_token()
…ort nested semi-structured path traversal
6dccdeb to
df6b53c
Compare
|
@iffyio Updated. Thank you |
| pub element: Option<Ident>, | ||
| /// Optional semi-structured element path following the column reference | ||
| /// (e.g. `$1:UsageMetrics:hh` produces `["UsageMetrics", "hh"]`). | ||
| pub element: Option<Vec<Ident>>, |
There was a problem hiding this comment.
I wonder, can we change this to element: Vec<Ident> to drop the option? feels like in this case it would be simpler if the Option no longer covers the previous intent
COPY INTO: support nested semi-structured path
|
Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days. |
Extended the Snowflake COPY INTO data-load select item parser to support nested semi-structured path traversal (e.g. $1:a:b:c) by looping over consecutive :element segments instead of consuming only one.
Example of query: