iffyio commented on code in PR #1979:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/1979#discussion_r2244813012
##########
src/parser/mod.rs:
##########
@@ -9586,14 +9586,14 @@ impl<'a> Parser<'a> {
tok @ Token::Colon | tok @ Token::AtSign => {
// Not calling self.parse_identifier(false)? because only in
placeholder we want to check numbers as idfentifies
// This because snowflake allows numbers as placeholders
- let next_token = self.next_token();
+ let next_token =
self.next_token_no_skip().unwrap_or(&EOF_TOKEN).clone();
Review Comment:
If I understand the intent correctly is this saying that e.g. `SELECT :foo`
is to be parsed as a placeholder but `SELECT : foo` should not? If so I think
it would be good to mention that in a comment. Also can we add a test case to
demonstrate this change?
##########
src/parser/mod.rs:
##########
@@ -9586,14 +9586,14 @@ impl<'a> Parser<'a> {
tok @ Token::Colon | tok @ Token::AtSign => {
// Not calling self.parse_identifier(false)? because only in
placeholder we want to check numbers as idfentifies
// This because snowflake allows numbers as placeholders
- let next_token = self.next_token();
+ let next_token =
self.next_token_no_skip().unwrap_or(&EOF_TOKEN).clone();
let ident = match next_token.token {
Token::Word(w) => Ok(w.into_ident(next_token.span)),
- Token::Number(w, false) => Ok(Ident::new(w)),
+ Token::Number(w, false) =>
Ok(Ident::with_span(next_token.span, w)),
_ => self.expected("placeholder", next_token),
}?;
- let placeholder = tok.to_string() + &ident.value;
- ok_value(Value::Placeholder(placeholder))
+ Ok(Value::Placeholder(tok.to_string() + &ident.value)
Review Comment:
Can we add a test case for this to avoid future regressions? we have some
[span test cases
here](https://github.com/apache/datafusion-sqlparser-rs/blob/10cd9e2bb008f71b6fcac5d439b78588b593d210/src/ast/spans.rs#L2365)
that we could add to
--
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]