iffyio commented on code in PR #1454:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/1454#discussion_r1805030512
##########
src/dialect/snowflake.rs:
##########
@@ -149,6 +153,44 @@ impl Dialect for SnowflakeDialect {
None
}
+ fn parse_column_option(
+ &self,
+ parser: &mut Parser,
+ ) -> Option<Result<Option<ColumnOption>, ParserError>> {
+ let with = parser.parse_keyword(Keyword::WITH);
+
+ if parser.parse_keyword(Keyword::IDENTITY) {
+ Some(
+ parse_identity_property(parser)
+ .map(|p|
Some(ColumnOption::Identity(IdentityPropertyKind::Identity(p)))),
+ )
+ } else if parser.parse_keyword(Keyword::AUTOINCREMENT) {
+ Some(parse_identity_property(parser).map(|p| {
+
Some(ColumnOption::Identity(IdentityPropertyKind::Autoincrement(
+ p,
+ )))
+ }))
+ } else if parser.parse_keywords(&[Keyword::MASKING, Keyword::POLICY]) {
+ Some(
+ parse_column_policy_property(parser, with)
+ .map(|p|
Some(ColumnOption::Policy(ColumnPolicy::MaskingPolicy(p)))),
+ )
+ } else if parser.parse_keywords(&[Keyword::PROJECTION,
Keyword::POLICY]) {
+ Some(
+ parse_column_policy_property(parser, with)
+ .map(|p|
Some(ColumnOption::Policy(ColumnPolicy::ProjectionPolicy(p)))),
+ )
+ } else if parser.parse_keywords(&[Keyword::TAG]) {
+ Some(parse_column_tags(parser, with).map(|p|
Some(ColumnOption::Tags(p))))
+ } else {
+ // needs to revert initial state of parser if dialect finds any
matching
+ if with {
+ parser.prev_token();
+ }
Review Comment:
for this part can we use `parser.maybe_parse`? I think that would handle
this automatically
##########
src/parser/mod.rs:
##########
@@ -6255,6 +6266,15 @@ impl<'a> Parser<'a> {
Ok(None)
}
}
+
+ pub fn parse_tag(&mut self) -> Result<Tag, ParserError> {
Review Comment:
```suggestion
pub(crate) fn parse_tag(&mut self) -> Result<Tag, ParserError> {
```
--
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]