7phs commented on code in PR #1454: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1454#discussion_r1793283035
########## src/parser/mod.rs: ########## @@ -6193,24 +6186,160 @@ impl<'a> Parser<'a> { && dialect_of!(self is MySqlDialect | SQLiteDialect | DuckDbDialect | GenericDialect) { self.parse_optional_column_option_as() + } else if self.parse_keyword(Keyword::AUTOINCREMENT) + && dialect_of!(self is SnowflakeDialect | SQLiteDialect | GenericDialect) + { + if dialect_of!(self is SnowflakeDialect) { + self.prev_token(); + return self.parse_snowflake_autoincrement_or_identity_option_column(); + } + + // Support AUTOINCREMENT for SQLite + Ok(Some(ColumnOption::DialectSpecific(vec![ + Token::make_keyword("AUTOINCREMENT"), + ]))) } else if self.parse_keyword(Keyword::IDENTITY) - && dialect_of!(self is MsSqlDialect | GenericDialect) + && dialect_of!(self is MsSqlDialect | SnowflakeDialect | GenericDialect) { - let property = if self.consume_token(&Token::LParen) { + if dialect_of!(self is SnowflakeDialect) { + self.prev_token(); + return self.parse_snowflake_autoincrement_or_identity_option_column(); + } + + let parameters = if self.consume_token(&Token::LParen) { let seed = self.parse_number()?; self.expect_token(&Token::Comma)?; let increment = self.parse_number()?; self.expect_token(&Token::RParen)?; - Some(IdentityProperty { seed, increment }) + Some(IdentityFormat::FunctionCall(IdentityParameters { + seed, + increment, + })) } else { None }; - Ok(Some(ColumnOption::Identity(property))) + Ok(Some(ColumnOption::Identity(Identity::Identity( + IdentityProperty { + parameters, + order: None, + }, + )))) + } else if ((self.parse_keyword(Keyword::WITH) + && self + .parse_one_of_keywords(&[Keyword::MASKING, Keyword::PROJECTION]) + .is_some()) + || self + .parse_one_of_keywords(&[Keyword::MASKING, Keyword::PROJECTION]) + .is_some()) Review Comment: I used this suggestion related to `with` parsing in common column option parsing function and in snowflake specific one. -- 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: dev-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@datafusion.apache.org For additional commands, e-mail: dev-h...@datafusion.apache.org