From 5d7ce08358c8de240ebfde8e01afa2a4a4b03f7f Mon Sep 17 00:00:00 2001 From: dennis zhuang Date: Wed, 27 Mar 2024 23:37:34 -0700 Subject: [PATCH] feat: adds metric engine to information_schema engines table (#3599) * feat: adds metric engine to information_schema engines table * fix: support value for metric engine --- .../src/information_schema/memory_table/tables.rs | 15 +++++++++------ .../common/system/information_schema.result | 11 ++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/catalog/src/information_schema/memory_table/tables.rs b/src/catalog/src/information_schema/memory_table/tables.rs index 9655725aece2..e1696ab8e106 100644 --- a/src/catalog/src/information_schema/memory_table/tables.rs +++ b/src/catalog/src/information_schema/memory_table/tables.rs @@ -14,13 +14,15 @@ use std::sync::Arc; -use common_catalog::consts::MITO_ENGINE; +use common_catalog::consts::{METRIC_ENGINE, MITO_ENGINE}; use datatypes::prelude::{ConcreteDataType, VectorRef}; use datatypes::schema::{ColumnSchema, Schema, SchemaRef}; use datatypes::vectors::{Int64Vector, StringVector}; use crate::information_schema::table_names::*; +const NO_VALUE: &str = "NO"; + /// Find the schema and columns by the table_name, only valid for memory tables. /// Safety: the user MUST ensure the table schema exists, panic otherwise. pub fn get_schema_columns(table_name: &str) -> (SchemaRef, Vec) { @@ -59,14 +61,15 @@ pub fn get_schema_columns(table_name: &str) -> (SchemaRef, Vec) { "SAVEPOINTS", ]), vec![ - Arc::new(StringVector::from(vec![MITO_ENGINE])), - Arc::new(StringVector::from(vec!["DEFAULT"])), + Arc::new(StringVector::from(vec![MITO_ENGINE, METRIC_ENGINE])), + Arc::new(StringVector::from(vec!["DEFAULT", "YES"])), Arc::new(StringVector::from(vec![ "Storage engine for time-series data", + "Storage engine for observability scenarios, which is adept at handling a large number of small tables, making it particularly suitable for cloud-native monitoring", ])), - Arc::new(StringVector::from(vec!["NO"])), - Arc::new(StringVector::from(vec!["NO"])), - Arc::new(StringVector::from(vec!["NO"])), + Arc::new(StringVector::from(vec![NO_VALUE, NO_VALUE])), + Arc::new(StringVector::from(vec![NO_VALUE, NO_VALUE])), + Arc::new(StringVector::from(vec![NO_VALUE, NO_VALUE])), ], ), diff --git a/tests/cases/standalone/common/system/information_schema.result b/tests/cases/standalone/common/system/information_schema.result index a6dec1d3bafc..330900ae7995 100644 --- a/tests/cases/standalone/common/system/information_schema.result +++ b/tests/cases/standalone/common/system/information_schema.result @@ -512,11 +512,12 @@ select * from schemata where catalog_name = 'greptime' and schema_name != 'publi -- test engines select * from engines; -+--------+---------+-------------------------------------+--------------+----+------------+ -| engine | support | comment | transactions | xa | savepoints | -+--------+---------+-------------------------------------+--------------+----+------------+ -| mito | DEFAULT | Storage engine for time-series data | NO | NO | NO | -+--------+---------+-------------------------------------+--------------+----+------------+ ++--------+---------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+----+------------+ +| engine | support | comment | transactions | xa | savepoints | ++--------+---------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+----+------------+ +| mito | DEFAULT | Storage engine for time-series data | NO | NO | NO | +| metric | YES | Storage engine for observability scenarios, which is adept at handling a large number of small tables, making it particularly suitable for cloud-native monitoring | NO | NO | NO | ++--------+---------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+----+------------+ desc table build_info;