diff --git a/src/dialect/hive.rs b/src/dialect/hive.rs index 3e15d395b..f3e400cf1 100644 --- a/src/dialect/hive.rs +++ b/src/dialect/hive.rs @@ -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 + } } diff --git a/tests/sqlparser_hive.rs b/tests/sqlparser_hive.rs index 7fe1d28cb..8108a685d 100644 --- a/tests/sqlparser_hive.rs +++ b/tests/sqlparser_hive.rs @@ -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");