mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-16 00:39:00 +00:00
MySQL: Support EXPLAIN ANALYZE
format variants (#1945)
Some checks failed
license / Release Audit Tool (RAT) (push) Has been cancelled
Rust / codestyle (push) Has been cancelled
Rust / lint (push) Has been cancelled
Rust / benchmark-lint (push) Has been cancelled
Rust / compile (push) Has been cancelled
Rust / docs (push) Has been cancelled
Rust / compile-no-std (push) Has been cancelled
Rust / test (beta) (push) Has been cancelled
Rust / test (nightly) (push) Has been cancelled
Rust / test (stable) (push) Has been cancelled
Some checks failed
license / Release Audit Tool (RAT) (push) Has been cancelled
Rust / codestyle (push) Has been cancelled
Rust / lint (push) Has been cancelled
Rust / benchmark-lint (push) Has been cancelled
Rust / compile (push) Has been cancelled
Rust / docs (push) Has been cancelled
Rust / compile-no-std (push) Has been cancelled
Rust / test (beta) (push) Has been cancelled
Rust / test (nightly) (push) Has been cancelled
Rust / test (stable) (push) Has been cancelled
This commit is contained in:
parent
40bbcc9834
commit
23f40cdc40
3 changed files with 47 additions and 7 deletions
|
@ -4126,7 +4126,7 @@ pub enum Statement {
|
|||
/// A SQL query that specifies what to explain
|
||||
statement: Box<Statement>,
|
||||
/// Optional output format of explain
|
||||
format: Option<AnalyzeFormat>,
|
||||
format: Option<AnalyzeFormatKind>,
|
||||
/// Postgres style utility options, `(analyze, verbose true)`
|
||||
options: Option<Vec<UtilityOption>>,
|
||||
},
|
||||
|
@ -4494,7 +4494,7 @@ impl fmt::Display for Statement {
|
|||
}
|
||||
|
||||
if let Some(format) = format {
|
||||
write!(f, "FORMAT {format} ")?;
|
||||
write!(f, "{format} ")?;
|
||||
}
|
||||
|
||||
if let Some(options) = options {
|
||||
|
@ -7641,6 +7641,25 @@ impl fmt::Display for DuplicateTreatment {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
|
||||
pub enum AnalyzeFormatKind {
|
||||
/// e.g. `EXPLAIN ANALYZE FORMAT JSON SELECT * FROM tbl`
|
||||
Keyword(AnalyzeFormat),
|
||||
/// e.g. `EXPLAIN ANALYZE FORMAT=JSON SELECT * FROM tbl`
|
||||
Assignment(AnalyzeFormat),
|
||||
}
|
||||
|
||||
impl fmt::Display for AnalyzeFormatKind {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
match self {
|
||||
AnalyzeFormatKind::Keyword(format) => write!(f, "FORMAT {format}"),
|
||||
AnalyzeFormatKind::Assignment(format) => write!(f, "FORMAT={format}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
|
||||
|
@ -7648,6 +7667,8 @@ pub enum AnalyzeFormat {
|
|||
TEXT,
|
||||
GRAPHVIZ,
|
||||
JSON,
|
||||
TRADITIONAL,
|
||||
TREE,
|
||||
}
|
||||
|
||||
impl fmt::Display for AnalyzeFormat {
|
||||
|
@ -7656,6 +7677,8 @@ impl fmt::Display for AnalyzeFormat {
|
|||
AnalyzeFormat::TEXT => "TEXT",
|
||||
AnalyzeFormat::GRAPHVIZ => "GRAPHVIZ",
|
||||
AnalyzeFormat::JSON => "JSON",
|
||||
AnalyzeFormat::TRADITIONAL => "TRADITIONAL",
|
||||
AnalyzeFormat::TREE => "TREE",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue