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
2 changes: 1 addition & 1 deletion src/ast/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11580,7 +11580,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![]
};
Expand Down
3 changes: 3 additions & 0 deletions tests/sqlparser_hive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down