Add support for TABLESAMPLE (#1580)

This commit is contained in:
Yoav Cohen 2024-12-15 10:40:25 +01:00 committed by GitHub
parent 7bc6ddb8fb
commit 316bb14135
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 546 additions and 458 deletions

View file

@ -459,6 +459,7 @@ fn parse_delimited_identifiers() {
with_ordinality: _,
partitions: _,
json_path: _,
sample: _,
} => {
assert_eq!(vec![Ident::with_quote('"', "a table")], name.0);
assert_eq!(Ident::with_quote('"', "alias"), alias.unwrap().name);
@ -537,6 +538,15 @@ fn parse_use() {
);
}
#[test]
fn test_tample_sample() {
hive().verified_stmt("SELECT * FROM source TABLESAMPLE (BUCKET 3 OUT OF 32 ON rand()) AS s");
hive().verified_stmt("SELECT * FROM source TABLESAMPLE (BUCKET 3 OUT OF 16 ON id)");
hive().verified_stmt("SELECT * FROM source TABLESAMPLE (100M) AS s");
hive().verified_stmt("SELECT * FROM source TABLESAMPLE (0.1 PERCENT) AS s");
hive().verified_stmt("SELECT * FROM source TABLESAMPLE (10 ROWS)");
}
fn hive() -> TestedDialects {
TestedDialects::new(vec![Box::new(HiveDialect {})])
}