pravic commented on code in PR #2024:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2024#discussion_r2336299075
##########
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),
+ }
+ }
+}
Review Comment:
But then we'd need way more changes in the existing code that relies on
https://docs.rs/sqlparser/latest/sqlparser/ast/struct.With.html#structfield.cte_tables
being `Cte`. I am on the edge here.
--
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]