mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-04 14:28:22 +00:00
clickhouse: add support for LIMIT BY (#977)
This commit is contained in:
parent
993769ec02
commit
2786c7eaf1
7 changed files with 56 additions and 1 deletions
|
@ -25,6 +25,7 @@ use sqlparser::ast::TableFactor::Table;
|
|||
use sqlparser::ast::*;
|
||||
|
||||
use sqlparser::dialect::ClickHouseDialect;
|
||||
use sqlparser::dialect::GenericDialect;
|
||||
|
||||
#[test]
|
||||
fn parse_map_access_expr() {
|
||||
|
@ -344,9 +345,26 @@ fn parse_double_equal() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_limit_by() {
|
||||
clickhouse_and_generic().verified_stmt(
|
||||
r#"SELECT * FROM default.last_asset_runs_mv ORDER BY created_at DESC LIMIT 1 BY asset"#,
|
||||
);
|
||||
clickhouse_and_generic().verified_stmt(
|
||||
r#"SELECT * FROM default.last_asset_runs_mv ORDER BY created_at DESC LIMIT 1 BY asset, toStartOfDay(created_at)"#,
|
||||
);
|
||||
}
|
||||
|
||||
fn clickhouse() -> TestedDialects {
|
||||
TestedDialects {
|
||||
dialects: vec![Box::new(ClickHouseDialect {})],
|
||||
options: None,
|
||||
}
|
||||
}
|
||||
|
||||
fn clickhouse_and_generic() -> TestedDialects {
|
||||
TestedDialects {
|
||||
dialects: vec![Box::new(ClickHouseDialect {}), Box::new(GenericDialect {})],
|
||||
options: None,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue