Support for INTERVAL inside window frames (#655)

* Add support to for INTERVAL inside window queries

* Remove the unnecessary ancillary struct Interval

* Convert Window Frame Bound to Expr

* remove unnecessary changes

* remove unnecessary changes

Co-authored-by: Mehmet Ozan Kabak <ozankabak@gmail.com>
This commit is contained in:
Mustafa akur 2022-10-15 13:34:52 +03:00 committed by GitHub
parent cacdf3305f
commit 427bec4ccc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

View file

@ -906,9 +906,9 @@ pub enum WindowFrameBound {
/// `CURRENT ROW`
CurrentRow,
/// `<N> PRECEDING` or `UNBOUNDED PRECEDING`
Preceding(Option<u64>),
Preceding(Option<Box<Expr>>),
/// `<N> FOLLOWING` or `UNBOUNDED FOLLOWING`.
Following(Option<u64>),
Following(Option<Box<Expr>>),
}
impl fmt::Display for WindowFrameBound {

View file

@ -623,7 +623,6 @@ impl<'a> Parser<'a> {
} else {
None
};
Ok(Expr::Function(Function {
name,
args,
@ -685,7 +684,10 @@ impl<'a> Parser<'a> {
let rows = if self.parse_keyword(Keyword::UNBOUNDED) {
None
} else {
Some(self.parse_literal_uint()?)
Some(Box::new(match self.peek_token() {
Token::SingleQuotedString(_) => self.parse_interval()?,
_ => self.parse_expr()?,
}))
};
if self.parse_keyword(Keyword::PRECEDING) {
Ok(WindowFrameBound::Preceding(rows))