mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-31 11:17:23 +00:00
Support parsing EXPLAIN ESTIMATE
of Clickhouse (#1605)
Co-authored-by: Kermit <chenjiawei1@xiaohongshu.com>
This commit is contained in:
parent
c69839102a
commit
8fcdf48e5c
4 changed files with 42 additions and 0 deletions
|
@ -4375,6 +4375,7 @@ fn run_explain_analyze(
|
|||
analyze,
|
||||
verbose,
|
||||
query_plan,
|
||||
estimate,
|
||||
statement,
|
||||
format,
|
||||
options,
|
||||
|
@ -4384,6 +4385,7 @@ fn run_explain_analyze(
|
|||
assert_eq!(format, expected_format);
|
||||
assert_eq!(options, exepcted_options);
|
||||
assert!(!query_plan);
|
||||
assert!(!estimate);
|
||||
assert_eq!("SELECT sqrt(id) FROM foo", statement.to_string());
|
||||
}
|
||||
_ => panic!("Unexpected Statement, must be Explain"),
|
||||
|
@ -4528,6 +4530,34 @@ fn parse_explain_query_plan() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_explain_estimate() {
|
||||
let statement = all_dialects().verified_stmt("EXPLAIN ESTIMATE SELECT sqrt(id) FROM foo");
|
||||
|
||||
match &statement {
|
||||
Statement::Explain {
|
||||
query_plan,
|
||||
estimate,
|
||||
analyze,
|
||||
verbose,
|
||||
statement,
|
||||
..
|
||||
} => {
|
||||
assert!(estimate);
|
||||
assert!(!query_plan);
|
||||
assert!(!analyze);
|
||||
assert!(!verbose);
|
||||
assert_eq!("SELECT sqrt(id) FROM foo", statement.to_string());
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
assert_eq!(
|
||||
"EXPLAIN ESTIMATE SELECT sqrt(id) FROM foo",
|
||||
statement.to_string()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_named_argument_function() {
|
||||
let dialects = all_dialects_where(|d| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue