mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-07 17:04:59 +00:00
feat: Hive: support SORT BY
direction (#1873)
This commit is contained in:
parent
4cf5e571d3
commit
e2b1ae36e9
3 changed files with 5 additions and 2 deletions
|
@ -341,7 +341,7 @@ pub struct Select {
|
|||
/// DISTRIBUTE BY (Hive)
|
||||
pub distribute_by: Vec<Expr>,
|
||||
/// SORT BY (Hive)
|
||||
pub sort_by: Vec<Expr>,
|
||||
pub sort_by: Vec<OrderByExpr>,
|
||||
/// HAVING
|
||||
pub having: Option<Expr>,
|
||||
/// WINDOW AS
|
||||
|
|
|
@ -11591,7 +11591,7 @@ impl<'a> Parser<'a> {
|
|||
};
|
||||
|
||||
let sort_by = if self.parse_keywords(&[Keyword::SORT, Keyword::BY]) {
|
||||
self.parse_comma_separated(Parser::parse_expr)?
|
||||
self.parse_comma_separated(Parser::parse_order_by_expr)?
|
||||
} else {
|
||||
vec![]
|
||||
};
|
||||
|
|
|
@ -341,6 +341,9 @@ fn lateral_view() {
|
|||
fn sort_by() {
|
||||
let sort_by = "SELECT * FROM db.table SORT BY a";
|
||||
hive().verified_stmt(sort_by);
|
||||
|
||||
let sort_by_with_direction = "SELECT * FROM db.table SORT BY a, b DESC";
|
||||
hive().verified_stmt(sort_by_with_direction);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue