7phs commented on code in PR #1576: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1576#discussion_r1870413689
########## src/dialect/redshift.rs: ########## @@ -41,10 +41,24 @@ impl Dialect for RedshiftSqlDialect { /// treating them as json path. If there is identifier then we assume /// there is no json path. fn is_proper_identifier_inside_quotes(&self, mut chars: Peekable<Chars<'_>>) -> bool { + // PartiQL (used as json path query language in Redshift) uses square bracket as + // a start character and a quote is a beginning of quoted identifier. + // Skipping analyzing token such as `"a"` and analyze only token that + // can be part of json path potentially. + // For ex., `[0]`, `['a']` (seems part of json path) or `["a"]` (normal quoted identifier) + if let Some(quote_start) = chars.peek() { + if *quote_start == '"' { + return true; + } + }; Review Comment: Thank you for feedback! A goal of this MR is improving implementation of RedShift dialect. The method `is_proper_identifier_inside_quotes` is implemented only for RedShift and I assume that it added only for RedShift specific case. I verified one more time and found that `SELECT foo["bar"] FROM table_name` or `SELECT foo['bar'] FROM table_name` is not valid in RedShift case. `SELECT foo."bar" FROM table_name` is only valid for this certain case. We don't need to care about this case. I updated comments. I'm going to improve verification of quoted identifier in this special case that you mentioned. Thank you for highlighting this edge case! -- 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-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org