mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-23 07:24:10 +00:00
Support OFFSET
LIMIT
as well as LIMIT
OFFSET
(#413)
* Inital support in current_timestamp * Support time functions * Add Test * Fix order of offset * Merge from main * Fix PR * Update Test * Do not allow repeated LIMIT or OFFSET Co-authored-by: Yuval Shkolar <yuval@illumex.ai>
This commit is contained in:
parent
87509f1dec
commit
33d4f27bfc
2 changed files with 45 additions and 10 deletions
|
@ -2499,17 +2499,18 @@ impl<'a> Parser<'a> {
|
|||
vec![]
|
||||
};
|
||||
|
||||
let limit = if self.parse_keyword(Keyword::LIMIT) {
|
||||
self.parse_limit()?
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let mut limit = None;
|
||||
let mut offset = None;
|
||||
|
||||
let offset = if self.parse_keyword(Keyword::OFFSET) {
|
||||
Some(self.parse_offset()?)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
for _x in 0..2 {
|
||||
if limit.is_none() && self.parse_keyword(Keyword::LIMIT) {
|
||||
limit = self.parse_limit()?
|
||||
}
|
||||
|
||||
if offset.is_none() && self.parse_keyword(Keyword::OFFSET) {
|
||||
offset = Some(self.parse_offset()?)
|
||||
}
|
||||
}
|
||||
|
||||
let fetch = if self.parse_keyword(Keyword::FETCH) {
|
||||
Some(self.parse_fetch()?)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue