-
Notifications
You must be signed in to change notification settings - Fork 653
Add support for ClickHouse CSE. #2024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 4 commits
8559018
6998a6d
5a62df3
258d1fd
43e4f10
0d767a8
4a307a9
f2ada38
a31ad5a
ec2abf6
a8cca3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -603,7 +603,7 @@ pub struct With { | |||||||||||||||||||||||||||||||
/// Token for the "WITH" keyword | ||||||||||||||||||||||||||||||||
pub with_token: AttachedToken, | ||||||||||||||||||||||||||||||||
pub recursive: bool, | ||||||||||||||||||||||||||||||||
pub cte_tables: Vec<Cte>, | ||||||||||||||||||||||||||||||||
pub cte_tables: Vec<CteOrCse>, | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
impl fmt::Display for With { | ||||||||||||||||||||||||||||||||
|
@@ -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 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), | |
} | |
} | |
} |
I think we can skip this impl, in order to reduce the API surface of the library
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is okay to skip, users can match directly on the enum when needed similar to other nodes in the AST
Uh oh!
There was an error while loading. Please reload this page.