Support EXPLAIN / DESCR / DESCRIBE [FORMATTED | EXTENDED] (#1156)

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
Jonathan Lehto 2024-03-01 14:07:04 -05:00 committed by GitHub
parent 991dbab755
commit ef4668075b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 103 additions and 30 deletions

View file

@ -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]