mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-31 03:07:20 +00:00
Support EXPLAIN
/ DESCR
/ DESCRIBE
[FORMATTED | EXTENDED]
(#1156)
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
parent
991dbab755
commit
ef4668075b
5 changed files with 103 additions and 30 deletions
|
@ -3932,19 +3932,32 @@ fn run_explain_analyze(
|
|||
|
||||
#[test]
|
||||
fn parse_explain_table() {
|
||||
let validate_explain = |query: &str, expected_describe_alias: bool| match verified_stmt(query) {
|
||||
Statement::ExplainTable {
|
||||
describe_alias,
|
||||
table_name,
|
||||
} => {
|
||||
assert_eq!(describe_alias, expected_describe_alias);
|
||||
assert_eq!("test_identifier", table_name.to_string());
|
||||
}
|
||||
_ => panic!("Unexpected Statement, must be ExplainTable"),
|
||||
};
|
||||
let validate_explain =
|
||||
|query: &str, expected_describe_alias: DescribeAlias| match verified_stmt(query) {
|
||||
Statement::ExplainTable {
|
||||
describe_alias,
|
||||
hive_format,
|
||||
table_name,
|
||||
} => {
|
||||
assert_eq!(describe_alias, expected_describe_alias);
|
||||
assert_eq!(hive_format, None);
|
||||
assert_eq!("test_identifier", table_name.to_string());
|
||||
}
|
||||
_ => panic!("Unexpected Statement, must be ExplainTable"),
|
||||
};
|
||||
|
||||
validate_explain("EXPLAIN test_identifier", false);
|
||||
validate_explain("DESCRIBE test_identifier", true);
|
||||
validate_explain("EXPLAIN test_identifier", DescribeAlias::Explain);
|
||||
validate_explain("DESCRIBE test_identifier", DescribeAlias::Describe);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn explain_describe() {
|
||||
verified_stmt("DESCRIBE test.table");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn explain_desc() {
|
||||
verified_stmt("DESC test.table");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue