iffyio commented on code in PR #1767:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1767#discussion_r2000290321


##########
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:
   I think we can instead turn this into a regular function if the goal is to 
reuse it, since its not expected to be able to turn an arbitrary keyword into a 
ContextModifier. 



-- 
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

Reply via email to