1#include "duckdb/parser/statement/explain_statement.hpp"
2#include "duckdb/parser/transformer.hpp"
3
4namespace duckdb {
5
6unique_ptr<ExplainStatement> Transformer::TransformExplain(duckdb_libpgquery::PGExplainStmt &stmt) {
7 auto explain_type = ExplainType::EXPLAIN_STANDARD;
8 if (stmt.options) {
9 for (auto n = stmt.options->head; n; n = n->next) {
10 auto def_elem = PGPointerCast<duckdb_libpgquery::PGDefElem>(ptr: n->data.ptr_value)->defname;
11 string elem(def_elem);
12 if (elem == "analyze") {
13 explain_type = ExplainType::EXPLAIN_ANALYZE;
14 } else {
15 throw NotImplementedException("Unimplemented explain type: %s", elem);
16 }
17 }
18 }
19 return make_uniq<ExplainStatement>(args: TransformStatement(stmt&: *stmt.query), args&: explain_type);
20}
21
22} // namespace duckdb
23