Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ pub enum Expr {
},
/// An array expression e.g. `ARRAY[1, 2]`
Array(Array),
/// An expression with field access, such as `SELECT (udf_returning_struct()).field`
DotExpr {
expr: Box<Expr>,
field: Ident,
},
}

impl fmt::Display for Expr {
Expand Down Expand Up @@ -508,6 +513,9 @@ impl fmt::Display for Expr {
Expr::Array(set) => {
write!(f, "{}", set)
}
Expr::DotExpr { expr, field } => {
write!(f, "{}.{}", expr, field)
}
}
}
}
Expand Down Expand Up @@ -2457,7 +2465,7 @@ impl fmt::Display for CopyLegacyCsvOption {
}
}

///
///
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum MergeClause {
Expand Down
9 changes: 8 additions & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,14 @@ impl<'a> Parser<'a> {
}
};
self.expect_token(&Token::RParen)?;
Ok(expr)
if !self.consume_token(&Token::Period) {
return Ok(expr);
}

Ok(Expr::DotExpr {
expr: Box::new(expr),
field: self.parse_identifier()?,
})
}
Token::Placeholder(_) => {
self.prev_token();
Expand Down