feat: support mysql flavor show processlist shortcut (#6328) (#6379)

* feat: support mysql flavor show processlist shortcut (#6328)

Signed-off-by: codephage. <381510760@qq.com>

* Refactor SHOW PROCESSLIST handling and add tests

Signed-off-by: codephage. <381510760@qq.com>

* add sqlness test

Signed-off-by: codephage. <381510760@qq.com>

* add sqlness test result

Signed-off-by: codephage. <381510760@qq.com>

* fix sqlness test show_processList

Signed-off-by: codephage. <381510760@qq.com>

---------

Signed-off-by: codephage. <381510760@qq.com>
This commit is contained in:
codephage
2025-06-24 11:50:16 +08:00
committed by GitHub
parent 90a3894564
commit 116d5cf82b
11 changed files with 169 additions and 20 deletions

View File

@@ -370,6 +370,7 @@ impl StatementExecutor {
Statement::Use(db) => self.use_database(db, query_ctx).await,
Statement::Admin(admin) => self.execute_admin_command(admin, query_ctx).await,
Statement::Kill(kill) => self.execute_kill(query_ctx, kill).await,
Statement::ShowProcesslist(show) => self.show_processlist(show, query_ctx).await,
}
}

View File

@@ -25,7 +25,7 @@ use sql::ast::Ident;
use sql::statements::create::Partitions;
use sql::statements::show::{
ShowColumns, ShowCreateFlow, ShowCreateView, ShowDatabases, ShowFlows, ShowIndex, ShowKind,
ShowRegion, ShowTableStatus, ShowTables, ShowVariables, ShowViews,
ShowProcessList, ShowRegion, ShowTableStatus, ShowTables, ShowVariables, ShowViews,
};
use sql::statements::OptionMap;
use table::metadata::TableType;
@@ -33,8 +33,9 @@ use table::table_name::TableName;
use table::TableRef;
use crate::error::{
self, CatalogSnafu, ExecuteStatementSnafu, ExternalSnafu, FindViewInfoSnafu, InvalidSqlSnafu,
Result, TableMetadataManagerSnafu, ViewInfoNotFoundSnafu, ViewNotFoundSnafu,
self, CatalogSnafu, ExecLogicalPlanSnafu, ExecuteStatementSnafu, ExternalSnafu,
FindViewInfoSnafu, InvalidSqlSnafu, Result, TableMetadataManagerSnafu, ViewInfoNotFoundSnafu,
ViewNotFoundSnafu,
};
use crate::statement::StatementExecutor;
@@ -314,6 +315,16 @@ impl StatementExecutor {
.await
.context(error::ExecuteStatementSnafu)
}
pub async fn show_processlist(
&self,
stmt: ShowProcessList,
query_ctx: QueryContextRef,
) -> Result<Output> {
query::sql::show_processlist(stmt, &self.query_engine, &self.catalog_manager, query_ctx)
.await
.context(ExecLogicalPlanSnafu)
}
}
pub(crate) fn create_partitions_stmt(partitions: Vec<PartitionInfo>) -> Result<Option<Partitions>> {