mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-24 17:00:37 +00:00
feat: support to generate json output for explain analyze in http api (#5567)
* impl Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * integration test Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * Update src/servers/src/http/hints.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * refactor: with FORMAT option for explain format * lift some well-known metrics Signed-off-by: Ruihang Xia <waynestxia@gmail.com> --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ning Sun <sunning@greptime.com>
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
use std::fmt::{Display, Formatter};
|
||||
|
||||
use serde::Serialize;
|
||||
use sqlparser::ast::Statement as SpStatement;
|
||||
use sqlparser::ast::{AnalyzeFormat, Statement as SpStatement};
|
||||
use sqlparser_derive::{Visit, VisitMut};
|
||||
|
||||
use crate::error::Error;
|
||||
@@ -26,6 +26,15 @@ pub struct Explain {
|
||||
pub inner: SpStatement,
|
||||
}
|
||||
|
||||
impl Explain {
|
||||
pub fn format(&self) -> Option<AnalyzeFormat> {
|
||||
match self.inner {
|
||||
SpStatement::Explain { format, .. } => format,
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<SpStatement> for Explain {
|
||||
type Error = Error;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user