bombsimon commented on code in PR #1884: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1884#discussion_r2150350430
########## 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>>, Review Comment: Added a description. Initially I used `Option<Option<Ident>>` because you can either do bare `RAISE` which re-reases the exception currently handled _or_ you can do `RASIE SOME_EXCEPTION` which reaises `SOME_EXCEPTION`. For BigQuery however this is a bit more complex, there you can something like this which was solved by using the already existing [`parse_raise_stmt`](https://github.com/apache/datafusion-sqlparser-rs/blob/23350bd8d8ee1ff87e2cacb6c9654a9ba1ab76a4/src/parser/mod.rs?plain=1#L786-L800). ```sql RAISE USING MESSAGE = FORMAT('Some issue: %s', i) ``` -- 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