bombsimon commented on code in PR #1884: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1884#discussion_r2150344133
########## src/ast/mod.rs: ########## @@ -2982,6 +2982,63 @@ impl From<Set> for Statement { } } +/// An exception representing exception handling with the `EXCEPTION` keyword. +/// +/// Snowflake: <https://docs.snowflake.com/en/sql-reference/snowflake-scripting/exception> +/// BigQuery: <https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language#beginexceptionend> +#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] +pub struct Exception { + pub when: Vec<ExceptionWhen>, + pub raises: Option<Box<Statement>>, +} + +impl Display for Exception { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, " EXCEPTION")?; + for w in &self.when { + write!(f, "{w}")?; + } + + if let Some(raises) = &self.raises { + write!(f, " {raises};")?; + } + + Ok(()) + } +} + +/// A representation of a `WHEN` arm with all the identifiers catched and the statements to execute +/// for the arm. Review Comment: Added same references! -- 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