Skip to content
Open
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
5 changes: 5 additions & 0 deletions src/dialect/hive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,9 @@ impl Dialect for HiveDialect {
fn supports_group_by_with_modifier(&self) -> bool {
true
}

/// Does the dialect support parsing `LIMIT 1, 2` as `LIMIT 2 OFFSET 1`?
fn supports_limit_comma(&self) -> bool {
true
}
}
7 changes: 7 additions & 0 deletions tests/sqlparser_hive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,13 @@ fn parse_use() {
);
}

#[test]
fn hive_limit_offset() {
let sql = "SELECT * FROM foo LIMIT 100, 200";
let expected = "SELECT * FROM foo LIMIT 200 OFFSET 100";
println!("{}", hive().one_statement_parses_to(sql, expected));
}

#[test]
fn test_tample_sample() {
hive().verified_stmt("SELECT * FROM source TABLESAMPLE (BUCKET 3 OUT OF 32 ON rand()) AS s");
Expand Down