Support for CONNECT BY (#1138)

This commit is contained in:
Joey Hain 2024-04-27 03:52:21 -07:00 committed by GitHub
parent deaa6d8151
commit 0b5722afbf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 319 additions and 4 deletions

View file

@ -40,9 +40,9 @@ pub use self::ddl::{
pub use self::dml::{Delete, Insert};
pub use self::operator::{BinaryOperator, UnaryOperator};
pub use self::query::{
AfterMatchSkip, Cte, CteAsMaterialized, Distinct, EmptyMatchesMode, ExceptSelectItem,
ExcludeSelectItem, Fetch, ForClause, ForJson, ForXml, GroupByExpr, IdentWithAlias,
IlikeSelectItem, Join, JoinConstraint, JoinOperator, JsonTableColumn,
AfterMatchSkip, ConnectBy, Cte, CteAsMaterialized, Distinct, EmptyMatchesMode,
ExceptSelectItem, ExcludeSelectItem, Fetch, ForClause, ForJson, ForXml, GroupByExpr,
IdentWithAlias, IlikeSelectItem, Join, JoinConstraint, JoinOperator, JsonTableColumn,
JsonTableColumnErrorHandling, LateralView, LockClause, LockType, MatchRecognizePattern,
MatchRecognizeSymbol, Measure, NamedWindowDefinition, NonBlock, Offset, OffsetRows,
OrderByExpr, Query, RenameSelectItem, RepetitionQuantifier, ReplaceSelectElement,
@ -798,6 +798,8 @@ pub enum Expr {
///
/// See <https://docs.snowflake.com/en/sql-reference/constructs/where#joins-in-the-where-clause>.
OuterJoin(Box<Expr>),
/// A reference to the prior level in a CONNECT BY clause.
Prior(Box<Expr>),
}
impl fmt::Display for CastFormat {
@ -1255,6 +1257,7 @@ impl fmt::Display for Expr {
Expr::OuterJoin(expr) => {
write!(f, "{expr} (+)")
}
Expr::Prior(expr) => write!(f, "PRIOR {expr}"),
}
}
}