mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-23 15:34:09 +00:00
add nulls first/last support to order by expression (#176)
Following `<sort specification list>` from the standard https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#_10_10_sort_specification_list
This commit is contained in:
parent
c918ff042d
commit
418b9631ce
5 changed files with 64 additions and 8 deletions
|
@ -2015,7 +2015,20 @@ impl Parser {
|
|||
} else {
|
||||
None
|
||||
};
|
||||
Ok(OrderByExpr { expr, asc })
|
||||
|
||||
let nulls_first = if self.parse_keywords(vec!["NULLS", "FIRST"]) {
|
||||
Some(true)
|
||||
} else if self.parse_keywords(vec!["NULLS", "LAST"]) {
|
||||
Some(false)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
Ok(OrderByExpr {
|
||||
expr,
|
||||
asc,
|
||||
nulls_first,
|
||||
})
|
||||
}
|
||||
|
||||
/// Parse a TOP clause, MSSQL equivalent of LIMIT,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue