MohamedAbdeen21 commented on code in PR #1767: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1767#discussion_r2001587043
########## src/ast/mod.rs: ########## @@ -7919,11 +7921,28 @@ impl fmt::Display for ContextModifier { write!(f, "") } Self::Local => { - write!(f, " LOCAL") + write!(f, "LOCAL ") } Self::Session => { - write!(f, " SESSION") + write!(f, "SESSION ") } + Self::Global => { + write!(f, "GLOBAL ") + } + } + } +} + +impl From<Option<Keyword>> for ContextModifier { + fn from(kw: Option<Keyword>) -> Self { + match kw { + Some(kw) => match kw { + Keyword::LOCAL => Self::Local, + Keyword::SESSION => Self::Session, + Keyword::GLOBAL => Self::Global, + _ => Self::None, + }, + None => Self::None, } } Review Comment: You'd still need to account for when the modifier var is a None. Unless you extract the None variant from ContextModifier and replace all ContextModifiers with options, which is a breaking change. -- 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