pravic commented on code in PR #2024:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2024#discussion_r2336292456


##########
src/ast/query.rs:
##########
@@ -641,6 +641,56 @@ impl fmt::Display for CteAsMaterialized {
     }
 }
 
+#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
+#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
+#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
+pub enum CteOrCse {
+    Cte(Cte),
+    Cse(Cse),
+}
+
+impl CteOrCse {
+    pub fn cte(&self) -> Option<&Cte> {
+        match self {
+            CteOrCse::Cte(cte) => Some(cte),
+            CteOrCse::Cse(_) => None,
+        }
+    }
+
+    pub fn cse(&self) -> Option<&Cse> {
+        match self {
+            CteOrCse::Cte(_) => None,
+            CteOrCse::Cse(cse) => Some(cse),
+        }
+    }
+}
+
+impl fmt::Display for CteOrCse {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        match self {
+            CteOrCse::Cte(cte) => cte.fmt(f),
+            CteOrCse::Cse(cse) => cse.fmt(f),
+        }
+    }
+}
+
+/// A single CSE (used after `WITH`): `<expr> AS <ident>`.

Review Comment:
   Here I just followed the doc style from the `CTE` below. But yeah, a better 
documentation is way more helpful.



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

Reply via email to