From fe36dabb0c01727aba885e41c64bab1e9b680deb Mon Sep 17 00:00:00 2001 From: test Date: Sun, 31 Dec 2023 21:55:37 +0800 Subject: [PATCH 01/14] feat: add information_schema.optimizer_trace --- src/catalog/src/information_schema.rs | 2 ++ .../src/information_schema/memory_table/tables.rs | 10 ++++++++++ src/catalog/src/information_schema/table_names.rs | 3 ++- src/common/catalog/src/consts.rs | 2 ++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/catalog/src/information_schema.rs b/src/catalog/src/information_schema.rs index f806e307b757..338a4cdaa5cc 100644 --- a/src/catalog/src/information_schema.rs +++ b/src/catalog/src/information_schema.rs @@ -61,6 +61,7 @@ lazy_static! { CHECK_CONSTRAINTS, EVENTS, FILES, + OPTIMIZER_TRACE, ]; } @@ -179,6 +180,7 @@ impl InformationSchemaProvider { CHECK_CONSTRAINTS => setup_memory_table!(CHECK_CONSTRAINTS), EVENTS => setup_memory_table!(EVENTS), FILES => setup_memory_table!(FILES), + OPTIMIZER_TRACE => setup_memory_table!(OPTIMIZER_TRACE), KEY_COLUMN_USAGE => Some(Arc::new(InformationSchemaKeyColumnUsage::new( self.catalog_name.clone(), self.catalog_manager.clone(), diff --git a/src/catalog/src/information_schema/memory_table/tables.rs b/src/catalog/src/information_schema/memory_table/tables.rs index 30be1fbaa748..1433fa46ae29 100644 --- a/src/catalog/src/information_schema/memory_table/tables.rs +++ b/src/catalog/src/information_schema/memory_table/tables.rs @@ -227,6 +227,16 @@ pub fn get_schema_columns(table_name: &str) -> (SchemaRef, Vec) { vec![], ), + OPTIMIZER_TRACE => ( + vec![ + string_column("QUERY"), + string_column("TRACE"), + bigint_column("MISSING_BYTES_BEYOND_MAX_MEM_SIZE"), + bigint_column("INSUFFICIENT_PRIVILEGES"), + ], + vec![], + ), + _ => unreachable!("Unknown table in information_schema: {}", table_name), }; diff --git a/src/catalog/src/information_schema/table_names.rs b/src/catalog/src/information_schema/table_names.rs index e1b23b4f6938..98fdec211227 100644 --- a/src/catalog/src/information_schema/table_names.rs +++ b/src/catalog/src/information_schema/table_names.rs @@ -25,6 +25,7 @@ pub const COLLATIONS: &str = "collations"; pub const COLLATION_CHARACTER_SET_APPLICABILITY: &str = "collation_character_set_applicability"; pub const CHECK_CONSTRAINTS: &str = "check_constraints"; pub const EVENTS: &str = "events"; -pub const KEY_COLUMN_USAGE: &str = "key_column_usage"; pub const FILES: &str = "files"; +pub const OPTIMIZER_TRACE: &str = "optimizer_trace"; pub const SCHEMATA: &str = "schemata"; +pub const KEY_COLUMN_USAGE: &str = "key_column_usage"; diff --git a/src/common/catalog/src/consts.rs b/src/common/catalog/src/consts.rs index 6af76120a5f8..b72fb0cb96f5 100644 --- a/src/common/catalog/src/consts.rs +++ b/src/common/catalog/src/consts.rs @@ -60,6 +60,8 @@ pub const INFORMATION_SCHEMA_FILES_TABLE_ID: u32 = 14; pub const INFORMATION_SCHEMA_SCHEMATA_TABLE_ID: u32 = 15; /// id for information_schema.KEY_COLUMN_USAGE pub const INFORMATION_SCHEMA_KEY_COLUMN_USAGE_TABLE_ID: u32 = 16; +/// id for information_schema.OPTIMIZER_TRACE +pub const INFORMATION_SCHEMA_OPTIMIZER_TRACE_TABLE_ID: u32 = 17; /// ----- End of information_schema tables ----- pub const MITO_ENGINE: &str = "mito"; From df826b37a3ee935839c3ce882c461a7600b55861 Mon Sep 17 00:00:00 2001 From: test Date: Sun, 31 Dec 2023 22:25:40 +0800 Subject: [PATCH 02/14] feat: add information_schema.parameters --- src/catalog/src/information_schema.rs | 2 ++ .../information_schema/memory_table/tables.rs | 26 +++++++++++++++++++ .../src/information_schema/table_names.rs | 1 + src/common/catalog/src/consts.rs | 2 ++ 4 files changed, 31 insertions(+) diff --git a/src/catalog/src/information_schema.rs b/src/catalog/src/information_schema.rs index 338a4cdaa5cc..002d39cee2f8 100644 --- a/src/catalog/src/information_schema.rs +++ b/src/catalog/src/information_schema.rs @@ -62,6 +62,7 @@ lazy_static! { EVENTS, FILES, OPTIMIZER_TRACE, + PARAMETERS, ]; } @@ -181,6 +182,7 @@ impl InformationSchemaProvider { EVENTS => setup_memory_table!(EVENTS), FILES => setup_memory_table!(FILES), OPTIMIZER_TRACE => setup_memory_table!(OPTIMIZER_TRACE), + PARAMETERS => setup_memory_table!(PARAMETERS), KEY_COLUMN_USAGE => Some(Arc::new(InformationSchemaKeyColumnUsage::new( self.catalog_name.clone(), self.catalog_manager.clone(), diff --git a/src/catalog/src/information_schema/memory_table/tables.rs b/src/catalog/src/information_schema/memory_table/tables.rs index 1433fa46ae29..21ac1e36f2a3 100644 --- a/src/catalog/src/information_schema/memory_table/tables.rs +++ b/src/catalog/src/information_schema/memory_table/tables.rs @@ -237,6 +237,32 @@ pub fn get_schema_columns(table_name: &str) -> (SchemaRef, Vec) { vec![], ), + // MySQL(https://dev.mysql.com/doc/refman/8.2/en/information-schema-parameters-table.html) + // has the spec that is different from + // PostgreSQL(https://www.postgresql.org/docs/current/infoschema-parameters.html). + // Follow `MySQL` spec here. + PARAMETERS => ( + vec![ + string_column("SPECIFIC_CATALOG"), + string_column("SPECIFIC_SCHEMA"), + string_column("SPECIFIC_NAME"), + bigint_column("ORDINAL_POSITION"), + string_column("PARAMETER_MODE"), + string_column("PARAMETER_NAME"), + string_column("DATA_TYPE"), + bigint_column("CHARACTER_MAXIMUM_LENGTH"), + bigint_column("CHARACTER_OCTET_LENGTH"), + bigint_column("NUMERIC_PRECISION"), + bigint_column("NUMERIC_SCALE"), + datetime_column("DATETIME_PRECISION"), + string_column("CHARACTER_SET_NAME"), + string_column("COLLATION_NAME"), + string_column("DTD_IDENTIFIER"), + string_column("ROUTINE_TYPE"), + ], + vec![], + ), + _ => unreachable!("Unknown table in information_schema: {}", table_name), }; diff --git a/src/catalog/src/information_schema/table_names.rs b/src/catalog/src/information_schema/table_names.rs index 98fdec211227..e6223be2ab6c 100644 --- a/src/catalog/src/information_schema/table_names.rs +++ b/src/catalog/src/information_schema/table_names.rs @@ -27,5 +27,6 @@ pub const CHECK_CONSTRAINTS: &str = "check_constraints"; pub const EVENTS: &str = "events"; pub const FILES: &str = "files"; pub const OPTIMIZER_TRACE: &str = "optimizer_trace"; +pub const PARAMETERS: &str = "parameters"; pub const SCHEMATA: &str = "schemata"; pub const KEY_COLUMN_USAGE: &str = "key_column_usage"; diff --git a/src/common/catalog/src/consts.rs b/src/common/catalog/src/consts.rs index b72fb0cb96f5..554601039b62 100644 --- a/src/common/catalog/src/consts.rs +++ b/src/common/catalog/src/consts.rs @@ -62,6 +62,8 @@ pub const INFORMATION_SCHEMA_SCHEMATA_TABLE_ID: u32 = 15; pub const INFORMATION_SCHEMA_KEY_COLUMN_USAGE_TABLE_ID: u32 = 16; /// id for information_schema.OPTIMIZER_TRACE pub const INFORMATION_SCHEMA_OPTIMIZER_TRACE_TABLE_ID: u32 = 17; +/// id for information_schema.PARAMETERS +pub const INFORMATION_SCHEMA_PARAMETERS_TABLE_ID: u32 = 18; /// ----- End of information_schema tables ----- pub const MITO_ENGINE: &str = "mito"; From a543d3260c9e103f481b73e8a46c8152404d65c9 Mon Sep 17 00:00:00 2001 From: test Date: Sun, 31 Dec 2023 22:46:31 +0800 Subject: [PATCH 03/14] feat: add information_schema.profiling --- src/catalog/src/information_schema.rs | 2 ++ .../information_schema/memory_table/tables.rs | 24 +++++++++++++++++++ .../src/information_schema/table_names.rs | 1 + src/common/catalog/src/consts.rs | 2 ++ 4 files changed, 29 insertions(+) diff --git a/src/catalog/src/information_schema.rs b/src/catalog/src/information_schema.rs index 002d39cee2f8..cbc841897406 100644 --- a/src/catalog/src/information_schema.rs +++ b/src/catalog/src/information_schema.rs @@ -63,6 +63,7 @@ lazy_static! { FILES, OPTIMIZER_TRACE, PARAMETERS, + PROFILING, ]; } @@ -183,6 +184,7 @@ impl InformationSchemaProvider { FILES => setup_memory_table!(FILES), OPTIMIZER_TRACE => setup_memory_table!(OPTIMIZER_TRACE), PARAMETERS => setup_memory_table!(PARAMETERS), + PROFILING => setup_memory_table!(PROFILING), KEY_COLUMN_USAGE => Some(Arc::new(InformationSchemaKeyColumnUsage::new( self.catalog_name.clone(), self.catalog_manager.clone(), diff --git a/src/catalog/src/information_schema/memory_table/tables.rs b/src/catalog/src/information_schema/memory_table/tables.rs index 21ac1e36f2a3..5dff581817db 100644 --- a/src/catalog/src/information_schema/memory_table/tables.rs +++ b/src/catalog/src/information_schema/memory_table/tables.rs @@ -263,6 +263,30 @@ pub fn get_schema_columns(table_name: &str) -> (SchemaRef, Vec) { vec![], ), + PROFILING => ( + vec![ + bigint_column("QUERY_ID"), + bigint_column("SEQ"), + string_column("STATE"), + bigint_column("DURATION"), + bigint_column("CPU_USER"), + bigint_column("CPU_SYSTEM"), + bigint_column("CONTEXT_VOLUNTARY"), + bigint_column("CONTEXT_INVOLUNTARY"), + bigint_column("BLOCK_OPS_IN"), + bigint_column("BLOCK_OPS_OUT"), + bigint_column("MESSAGES_SENT"), + bigint_column("MESSAGES_RECEIVED"), + bigint_column("PAGE_FAULTS_MAJOR"), + bigint_column("PAGE_FAULTS_MINOR"), + bigint_column("SWAPS"), + string_column("SOURCE_FUNCTION"), + string_column("SOURCE_FILE"), + bigint_column("SOURCE_LINE"), + ], + vec![], + ), + _ => unreachable!("Unknown table in information_schema: {}", table_name), }; diff --git a/src/catalog/src/information_schema/table_names.rs b/src/catalog/src/information_schema/table_names.rs index e6223be2ab6c..aeab32a23e82 100644 --- a/src/catalog/src/information_schema/table_names.rs +++ b/src/catalog/src/information_schema/table_names.rs @@ -28,5 +28,6 @@ pub const EVENTS: &str = "events"; pub const FILES: &str = "files"; pub const OPTIMIZER_TRACE: &str = "optimizer_trace"; pub const PARAMETERS: &str = "parameters"; +pub const PROFILING: &str = "profiling"; pub const SCHEMATA: &str = "schemata"; pub const KEY_COLUMN_USAGE: &str = "key_column_usage"; diff --git a/src/common/catalog/src/consts.rs b/src/common/catalog/src/consts.rs index 554601039b62..ca5064893675 100644 --- a/src/common/catalog/src/consts.rs +++ b/src/common/catalog/src/consts.rs @@ -64,6 +64,8 @@ pub const INFORMATION_SCHEMA_KEY_COLUMN_USAGE_TABLE_ID: u32 = 16; pub const INFORMATION_SCHEMA_OPTIMIZER_TRACE_TABLE_ID: u32 = 17; /// id for information_schema.PARAMETERS pub const INFORMATION_SCHEMA_PARAMETERS_TABLE_ID: u32 = 18; +/// id for information_schema.PROFILING +pub const INFORMATION_SCHEMA_PROFILING_TABLE_ID: u32 = 19; /// ----- End of information_schema tables ----- pub const MITO_ENGINE: &str = "mito"; From d0ba3eaea4830dae6f726a356800dc01dc186924 Mon Sep 17 00:00:00 2001 From: test Date: Sun, 31 Dec 2023 22:52:20 +0800 Subject: [PATCH 04/14] feat: add information_schema.referential_constraints --- src/catalog/src/information_schema.rs | 2 ++ .../information_schema/memory_table/tables.rs | 17 +++++++++++++++++ .../src/information_schema/table_names.rs | 1 + src/common/catalog/src/consts.rs | 2 ++ 4 files changed, 22 insertions(+) diff --git a/src/catalog/src/information_schema.rs b/src/catalog/src/information_schema.rs index cbc841897406..2e4f5326fb13 100644 --- a/src/catalog/src/information_schema.rs +++ b/src/catalog/src/information_schema.rs @@ -64,6 +64,7 @@ lazy_static! { OPTIMIZER_TRACE, PARAMETERS, PROFILING, + REFERENTIAL_CONSTRAINTS, ]; } @@ -185,6 +186,7 @@ impl InformationSchemaProvider { OPTIMIZER_TRACE => setup_memory_table!(OPTIMIZER_TRACE), PARAMETERS => setup_memory_table!(PARAMETERS), PROFILING => setup_memory_table!(PROFILING), + REFERENTIAL_CONSTRAINTS => setup_memory_table!(REFERENTIAL_CONSTRAINTS), KEY_COLUMN_USAGE => Some(Arc::new(InformationSchemaKeyColumnUsage::new( self.catalog_name.clone(), self.catalog_manager.clone(), diff --git a/src/catalog/src/information_schema/memory_table/tables.rs b/src/catalog/src/information_schema/memory_table/tables.rs index 5dff581817db..0c1744a02474 100644 --- a/src/catalog/src/information_schema/memory_table/tables.rs +++ b/src/catalog/src/information_schema/memory_table/tables.rs @@ -287,6 +287,23 @@ pub fn get_schema_columns(table_name: &str) -> (SchemaRef, Vec) { vec![], ), + REFERENTIAL_CONSTRAINTS => ( + vec![ + string_column("CONSTRAINT_CATALOG"), + string_column("CONSTRAINT_SCHEMA"), + string_column("CONSTRAINT_NAME"), + string_column("UNIQUE_CONSTRAINT_CATALOG"), + string_column("UNIQUE_CONSTRAINT_SCHEMA"), + string_column("UNIQUE_CONSTRAINT_NAME"), + string_column("MATCH_OPTION"), + string_column("UPDATE_RULE"), + string_column("DELETE_RULE"), + string_column("TABLE_NAME"), + string_column("REFERENCED_TABLE_NAME"), + ], + vec![], + ), + _ => unreachable!("Unknown table in information_schema: {}", table_name), }; diff --git a/src/catalog/src/information_schema/table_names.rs b/src/catalog/src/information_schema/table_names.rs index aeab32a23e82..019f366924e0 100644 --- a/src/catalog/src/information_schema/table_names.rs +++ b/src/catalog/src/information_schema/table_names.rs @@ -29,5 +29,6 @@ pub const FILES: &str = "files"; pub const OPTIMIZER_TRACE: &str = "optimizer_trace"; pub const PARAMETERS: &str = "parameters"; pub const PROFILING: &str = "profiling"; +pub const REFERENTIAL_CONSTRAINTS: &str = "referential_constraints"; pub const SCHEMATA: &str = "schemata"; pub const KEY_COLUMN_USAGE: &str = "key_column_usage"; diff --git a/src/common/catalog/src/consts.rs b/src/common/catalog/src/consts.rs index ca5064893675..f7ba6d3eca9b 100644 --- a/src/common/catalog/src/consts.rs +++ b/src/common/catalog/src/consts.rs @@ -66,6 +66,8 @@ pub const INFORMATION_SCHEMA_OPTIMIZER_TRACE_TABLE_ID: u32 = 17; pub const INFORMATION_SCHEMA_PARAMETERS_TABLE_ID: u32 = 18; /// id for information_schema.PROFILING pub const INFORMATION_SCHEMA_PROFILING_TABLE_ID: u32 = 19; +/// id for information_schema.REFERENTIAL_CONSTRAINTS +pub const INFORMATION_SCHEMA_REFERENTIAL_CONSTRAINTS_TABLE_ID: u32 = 20; /// ----- End of information_schema tables ----- pub const MITO_ENGINE: &str = "mito"; From 11ade0bb026c493f66bac87ba93427c70d249a96 Mon Sep 17 00:00:00 2001 From: test Date: Sun, 31 Dec 2023 23:47:26 +0800 Subject: [PATCH 05/14] feat: add information_schema.routines --- src/catalog/src/information_schema.rs | 2 + .../information_schema/memory_table/tables.rs | 39 ++++++++++++++++++- .../src/information_schema/table_names.rs | 1 + src/common/catalog/src/consts.rs | 2 + 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/catalog/src/information_schema.rs b/src/catalog/src/information_schema.rs index 2e4f5326fb13..a45a495aae98 100644 --- a/src/catalog/src/information_schema.rs +++ b/src/catalog/src/information_schema.rs @@ -65,6 +65,7 @@ lazy_static! { PARAMETERS, PROFILING, REFERENTIAL_CONSTRAINTS, + ROUTINES, ]; } @@ -187,6 +188,7 @@ impl InformationSchemaProvider { PARAMETERS => setup_memory_table!(PARAMETERS), PROFILING => setup_memory_table!(PROFILING), REFERENTIAL_CONSTRAINTS => setup_memory_table!(REFERENTIAL_CONSTRAINTS), + ROUTINES => setup_memory_table!(ROUTINES), KEY_COLUMN_USAGE => Some(Arc::new(InformationSchemaKeyColumnUsage::new( self.catalog_name.clone(), self.catalog_manager.clone(), diff --git a/src/catalog/src/information_schema/memory_table/tables.rs b/src/catalog/src/information_schema/memory_table/tables.rs index 0c1744a02474..2ea28e643c2c 100644 --- a/src/catalog/src/information_schema/memory_table/tables.rs +++ b/src/catalog/src/information_schema/memory_table/tables.rs @@ -254,7 +254,7 @@ pub fn get_schema_columns(table_name: &str) -> (SchemaRef, Vec) { bigint_column("CHARACTER_OCTET_LENGTH"), bigint_column("NUMERIC_PRECISION"), bigint_column("NUMERIC_SCALE"), - datetime_column("DATETIME_PRECISION"), + bigint_column("DATETIME_PRECISION"), string_column("CHARACTER_SET_NAME"), string_column("COLLATION_NAME"), string_column("DTD_IDENTIFIER"), @@ -304,6 +304,43 @@ pub fn get_schema_columns(table_name: &str) -> (SchemaRef, Vec) { vec![], ), + ROUTINES => ( + vec![ + string_column("SPECIFIC_NAME"), + string_column("ROUTINE_CATALOG"), + string_column("ROUTINE_SCHEMA"), + string_column("ROUTINE_NAME"), + string_column("ROUTINE_TYPE"), + string_column("DATA_TYPE"), + bigint_column("CHARACTER_MAXIMUM_LENGTH"), + bigint_column("CHARACTER_OCTET_LENGTH"), + bigint_column("NUMERIC_PRECISION"), + bigint_column("NUMERIC_SCALE"), + bigint_column("DATETIME_PRECISION"), + string_column("CHARACTER_SET_NAME"), + string_column("COLLATION_NAME"), + string_column("DTD_IDENTIFIER"), + string_column("ROUTINE_BODY"), + string_column("ROUTINE_DEFINITION"), + string_column("EXTERNAL_NAME"), + string_column("EXTERNAL_LANGUAGE"), + string_column("PARAMETER_STYLE"), + string_column("IS_DETERMINISTIC"), + string_column("SQL_DATA_ACCESS"), + string_column("SQL_PATH"), + string_column("SECURITY_TYPE"), + datetime_column("CREATED"), + datetime_column("LAST_ALTERED"), + string_column("SQL_MODE"), + string_column("ROUTINE_COMMENT"), + string_column("DEFINER"), + string_column("CHARACTER_SET_CLIENT"), + string_column("COLLATION_CONNECTION"), + string_column("DATABASE_COLLATION"), + ], + vec![], + ), + _ => unreachable!("Unknown table in information_schema: {}", table_name), }; diff --git a/src/catalog/src/information_schema/table_names.rs b/src/catalog/src/information_schema/table_names.rs index 019f366924e0..19863ccce254 100644 --- a/src/catalog/src/information_schema/table_names.rs +++ b/src/catalog/src/information_schema/table_names.rs @@ -30,5 +30,6 @@ pub const OPTIMIZER_TRACE: &str = "optimizer_trace"; pub const PARAMETERS: &str = "parameters"; pub const PROFILING: &str = "profiling"; pub const REFERENTIAL_CONSTRAINTS: &str = "referential_constraints"; +pub const ROUTINES: &str = "routines"; pub const SCHEMATA: &str = "schemata"; pub const KEY_COLUMN_USAGE: &str = "key_column_usage"; diff --git a/src/common/catalog/src/consts.rs b/src/common/catalog/src/consts.rs index f7ba6d3eca9b..15bedc314338 100644 --- a/src/common/catalog/src/consts.rs +++ b/src/common/catalog/src/consts.rs @@ -68,6 +68,8 @@ pub const INFORMATION_SCHEMA_PARAMETERS_TABLE_ID: u32 = 18; pub const INFORMATION_SCHEMA_PROFILING_TABLE_ID: u32 = 19; /// id for information_schema.REFERENTIAL_CONSTRAINTS pub const INFORMATION_SCHEMA_REFERENTIAL_CONSTRAINTS_TABLE_ID: u32 = 20; +/// id for information_schema.ROUTINES +pub const INFORMATION_SCHEMA_ROUTINES_TABLE_ID: u32 = 21; /// ----- End of information_schema tables ----- pub const MITO_ENGINE: &str = "mito"; From 16d52660f514e4d67a642c6374355fcca52ff570 Mon Sep 17 00:00:00 2001 From: test Date: Sun, 31 Dec 2023 23:51:13 +0800 Subject: [PATCH 06/14] feat: add information_schema.schema_privileges --- src/catalog/src/information_schema.rs | 2 ++ .../src/information_schema/memory_table/tables.rs | 11 +++++++++++ src/catalog/src/information_schema/table_names.rs | 1 + src/common/catalog/src/consts.rs | 2 ++ 4 files changed, 16 insertions(+) diff --git a/src/catalog/src/information_schema.rs b/src/catalog/src/information_schema.rs index a45a495aae98..06d170a018e1 100644 --- a/src/catalog/src/information_schema.rs +++ b/src/catalog/src/information_schema.rs @@ -66,6 +66,7 @@ lazy_static! { PROFILING, REFERENTIAL_CONSTRAINTS, ROUTINES, + SCHEMA_PRIVILEGES, ]; } @@ -189,6 +190,7 @@ impl InformationSchemaProvider { PROFILING => setup_memory_table!(PROFILING), REFERENTIAL_CONSTRAINTS => setup_memory_table!(REFERENTIAL_CONSTRAINTS), ROUTINES => setup_memory_table!(ROUTINES), + SCHEMA_PRIVILEGES => setup_memory_table!(SCHEMA_PRIVILEGES), KEY_COLUMN_USAGE => Some(Arc::new(InformationSchemaKeyColumnUsage::new( self.catalog_name.clone(), self.catalog_manager.clone(), diff --git a/src/catalog/src/information_schema/memory_table/tables.rs b/src/catalog/src/information_schema/memory_table/tables.rs index 2ea28e643c2c..3ac278306589 100644 --- a/src/catalog/src/information_schema/memory_table/tables.rs +++ b/src/catalog/src/information_schema/memory_table/tables.rs @@ -341,6 +341,17 @@ pub fn get_schema_columns(table_name: &str) -> (SchemaRef, Vec) { vec![], ), + SCHEMA_PRIVILEGES => ( + vec![ + string_column("GRANTEE"), + string_column("TABLE_CATALOG"), + string_column("TABLE_SCHEMA"), + string_column("PRIVILEGE_TYPE"), + string_column("IS_GRANTABLE"), + ], + vec![], + ), + _ => unreachable!("Unknown table in information_schema: {}", table_name), }; diff --git a/src/catalog/src/information_schema/table_names.rs b/src/catalog/src/information_schema/table_names.rs index 19863ccce254..2dd4f2a35c05 100644 --- a/src/catalog/src/information_schema/table_names.rs +++ b/src/catalog/src/information_schema/table_names.rs @@ -31,5 +31,6 @@ pub const PARAMETERS: &str = "parameters"; pub const PROFILING: &str = "profiling"; pub const REFERENTIAL_CONSTRAINTS: &str = "referential_constraints"; pub const ROUTINES: &str = "routines"; +pub const SCHEMA_PRIVILEGES: &str = "schema_privileges"; pub const SCHEMATA: &str = "schemata"; pub const KEY_COLUMN_USAGE: &str = "key_column_usage"; diff --git a/src/common/catalog/src/consts.rs b/src/common/catalog/src/consts.rs index 15bedc314338..f3e3cdfe0788 100644 --- a/src/common/catalog/src/consts.rs +++ b/src/common/catalog/src/consts.rs @@ -70,6 +70,8 @@ pub const INFORMATION_SCHEMA_PROFILING_TABLE_ID: u32 = 19; pub const INFORMATION_SCHEMA_REFERENTIAL_CONSTRAINTS_TABLE_ID: u32 = 20; /// id for information_schema.ROUTINES pub const INFORMATION_SCHEMA_ROUTINES_TABLE_ID: u32 = 21; +/// id for information_schema.SCHEMA_PRIVILEGES +pub const INFORMATION_SCHEMA_SCHEMA_PRIVILEGES_TABLE_ID: u32 = 22; /// ----- End of information_schema tables ----- pub const MITO_ENGINE: &str = "mito"; From d919dbfb73509309c42c852dd63879b881542bff Mon Sep 17 00:00:00 2001 From: test Date: Mon, 1 Jan 2024 00:04:12 +0800 Subject: [PATCH 07/14] feat: add information_schema.table_privileges --- src/catalog/src/information_schema.rs | 2 ++ .../src/information_schema/memory_table/tables.rs | 12 ++++++++++++ src/catalog/src/information_schema/table_names.rs | 1 + src/common/catalog/src/consts.rs | 2 ++ 4 files changed, 17 insertions(+) diff --git a/src/catalog/src/information_schema.rs b/src/catalog/src/information_schema.rs index 06d170a018e1..397af2bc18b4 100644 --- a/src/catalog/src/information_schema.rs +++ b/src/catalog/src/information_schema.rs @@ -67,6 +67,7 @@ lazy_static! { REFERENTIAL_CONSTRAINTS, ROUTINES, SCHEMA_PRIVILEGES, + TABLE_PRIVILEGES, ]; } @@ -191,6 +192,7 @@ impl InformationSchemaProvider { REFERENTIAL_CONSTRAINTS => setup_memory_table!(REFERENTIAL_CONSTRAINTS), ROUTINES => setup_memory_table!(ROUTINES), SCHEMA_PRIVILEGES => setup_memory_table!(SCHEMA_PRIVILEGES), + TABLE_PRIVILEGES => setup_memory_table!(TABLE_PRIVILEGES), KEY_COLUMN_USAGE => Some(Arc::new(InformationSchemaKeyColumnUsage::new( self.catalog_name.clone(), self.catalog_manager.clone(), diff --git a/src/catalog/src/information_schema/memory_table/tables.rs b/src/catalog/src/information_schema/memory_table/tables.rs index 3ac278306589..98996d471eba 100644 --- a/src/catalog/src/information_schema/memory_table/tables.rs +++ b/src/catalog/src/information_schema/memory_table/tables.rs @@ -352,6 +352,18 @@ pub fn get_schema_columns(table_name: &str) -> (SchemaRef, Vec) { vec![], ), + TABLE_PRIVILEGES => ( + vec![ + string_column("GRANTEE"), + string_column("TABLE_CATALOG"), + string_column("TABLE_SCHEMA"), + string_column("TABLE_NAME"), + string_column("PRIVILEGE_TYPE"), + string_column("IS_GRANTABLE"), + ], + vec![], + ), + _ => unreachable!("Unknown table in information_schema: {}", table_name), }; diff --git a/src/catalog/src/information_schema/table_names.rs b/src/catalog/src/information_schema/table_names.rs index 2dd4f2a35c05..1a2926e0760e 100644 --- a/src/catalog/src/information_schema/table_names.rs +++ b/src/catalog/src/information_schema/table_names.rs @@ -32,5 +32,6 @@ pub const PROFILING: &str = "profiling"; pub const REFERENTIAL_CONSTRAINTS: &str = "referential_constraints"; pub const ROUTINES: &str = "routines"; pub const SCHEMA_PRIVILEGES: &str = "schema_privileges"; +pub const TABLE_PRIVILEGES: &str = "table_privileges"; pub const SCHEMATA: &str = "schemata"; pub const KEY_COLUMN_USAGE: &str = "key_column_usage"; diff --git a/src/common/catalog/src/consts.rs b/src/common/catalog/src/consts.rs index f3e3cdfe0788..1c59a380d345 100644 --- a/src/common/catalog/src/consts.rs +++ b/src/common/catalog/src/consts.rs @@ -72,6 +72,8 @@ pub const INFORMATION_SCHEMA_REFERENTIAL_CONSTRAINTS_TABLE_ID: u32 = 20; pub const INFORMATION_SCHEMA_ROUTINES_TABLE_ID: u32 = 21; /// id for information_schema.SCHEMA_PRIVILEGES pub const INFORMATION_SCHEMA_SCHEMA_PRIVILEGES_TABLE_ID: u32 = 22; +/// id for information_schema.TABLE_PRIVILEGES +pub const INFORMATION_SCHEMA_TABLE_PRIVILEGES_TABLE_ID: u32 = 23; /// ----- End of information_schema tables ----- pub const MITO_ENGINE: &str = "mito"; From 449800dc5fc9390e83f8eef1cb57b32b50707520 Mon Sep 17 00:00:00 2001 From: test Date: Mon, 1 Jan 2024 00:19:31 +0800 Subject: [PATCH 08/14] feat: add information_schema.triggers --- src/catalog/src/information_schema.rs | 2 ++ .../information_schema/memory_table/tables.rs | 28 +++++++++++++++++++ .../src/information_schema/table_names.rs | 1 + src/common/catalog/src/consts.rs | 2 ++ 4 files changed, 33 insertions(+) diff --git a/src/catalog/src/information_schema.rs b/src/catalog/src/information_schema.rs index 397af2bc18b4..4142d39f99fb 100644 --- a/src/catalog/src/information_schema.rs +++ b/src/catalog/src/information_schema.rs @@ -68,6 +68,7 @@ lazy_static! { ROUTINES, SCHEMA_PRIVILEGES, TABLE_PRIVILEGES, + TRIGGERS, ]; } @@ -193,6 +194,7 @@ impl InformationSchemaProvider { ROUTINES => setup_memory_table!(ROUTINES), SCHEMA_PRIVILEGES => setup_memory_table!(SCHEMA_PRIVILEGES), TABLE_PRIVILEGES => setup_memory_table!(TABLE_PRIVILEGES), + TRIGGERS => setup_memory_table!(TRIGGERS), KEY_COLUMN_USAGE => Some(Arc::new(InformationSchemaKeyColumnUsage::new( self.catalog_name.clone(), self.catalog_manager.clone(), diff --git a/src/catalog/src/information_schema/memory_table/tables.rs b/src/catalog/src/information_schema/memory_table/tables.rs index 98996d471eba..26780a28dca1 100644 --- a/src/catalog/src/information_schema/memory_table/tables.rs +++ b/src/catalog/src/information_schema/memory_table/tables.rs @@ -364,6 +364,34 @@ pub fn get_schema_columns(table_name: &str) -> (SchemaRef, Vec) { vec![], ), + TRIGGERS => ( + vec![ + string_column("TRIGGER_CATALOG"), + string_column("TRIGGER_SCHEMA"), + string_column("TRIGGER_NAME"), + string_column("EVENT_MANIPULATION"), + string_column("EVENT_OBJECT_CATALOG"), + string_column("EVENT_OBJECT_SCHEMA"), + string_column("EVENT_OBJECT_TABLE"), + bigint_column("ACTION_ORDER"), + string_column("ACTION_CONDITION"), + string_column("ACTION_STATEMENT"), + string_column("ACTION_ORIENTATION"), + string_column("ACTION_TIMING"), + string_column("ACTION_REFERENCE_OLD_TABLE"), + string_column("ACTION_REFERENCE_NEW_TABLE"), + string_column("ACTION_REFERENCE_OLD_ROW"), + string_column("ACTION_REFERENCE_NEW_ROW"), + datetime_column("CREATED"), + string_column("SQL_MODE"), + string_column("DEFINER"), + string_column("CHARACTER_SET_CLIENT"), + string_column("COLLATION_CONNECTION"), + string_column("DATABASE_COLLATION"), + ], + vec![], + ), + _ => unreachable!("Unknown table in information_schema: {}", table_name), }; diff --git a/src/catalog/src/information_schema/table_names.rs b/src/catalog/src/information_schema/table_names.rs index 1a2926e0760e..f821535f0c21 100644 --- a/src/catalog/src/information_schema/table_names.rs +++ b/src/catalog/src/information_schema/table_names.rs @@ -33,5 +33,6 @@ pub const REFERENTIAL_CONSTRAINTS: &str = "referential_constraints"; pub const ROUTINES: &str = "routines"; pub const SCHEMA_PRIVILEGES: &str = "schema_privileges"; pub const TABLE_PRIVILEGES: &str = "table_privileges"; +pub const TRIGGERS: &str = "triggers"; pub const SCHEMATA: &str = "schemata"; pub const KEY_COLUMN_USAGE: &str = "key_column_usage"; diff --git a/src/common/catalog/src/consts.rs b/src/common/catalog/src/consts.rs index 1c59a380d345..a6dcbd6d33dc 100644 --- a/src/common/catalog/src/consts.rs +++ b/src/common/catalog/src/consts.rs @@ -74,6 +74,8 @@ pub const INFORMATION_SCHEMA_ROUTINES_TABLE_ID: u32 = 21; pub const INFORMATION_SCHEMA_SCHEMA_PRIVILEGES_TABLE_ID: u32 = 22; /// id for information_schema.TABLE_PRIVILEGES pub const INFORMATION_SCHEMA_TABLE_PRIVILEGES_TABLE_ID: u32 = 23; +/// id for information_schema.TRIGGERS +pub const INFORMATION_SCHEMA_TRIGGERS_TABLE_ID: u32 = 24; /// ----- End of information_schema tables ----- pub const MITO_ENGINE: &str = "mito"; From d8d4aae63d0c3d7356a73e77c5d96b767ee27223 Mon Sep 17 00:00:00 2001 From: test Date: Mon, 1 Jan 2024 00:35:14 +0800 Subject: [PATCH 09/14] fix: update sql test result --- .../src/information_schema/table_names.rs | 4 +- .../common/show/show_databases_tables.result | 8 + .../common/system/information_schema.result | 397 ++++++++++++------ 3 files changed, 269 insertions(+), 140 deletions(-) diff --git a/src/catalog/src/information_schema/table_names.rs b/src/catalog/src/information_schema/table_names.rs index f821535f0c21..c119598816e1 100644 --- a/src/catalog/src/information_schema/table_names.rs +++ b/src/catalog/src/information_schema/table_names.rs @@ -26,6 +26,8 @@ pub const COLLATION_CHARACTER_SET_APPLICABILITY: &str = "collation_character_set pub const CHECK_CONSTRAINTS: &str = "check_constraints"; pub const EVENTS: &str = "events"; pub const FILES: &str = "files"; +pub const SCHEMATA: &str = "schemata"; +pub const KEY_COLUMN_USAGE: &str = "key_column_usage"; pub const OPTIMIZER_TRACE: &str = "optimizer_trace"; pub const PARAMETERS: &str = "parameters"; pub const PROFILING: &str = "profiling"; @@ -34,5 +36,3 @@ pub const ROUTINES: &str = "routines"; pub const SCHEMA_PRIVILEGES: &str = "schema_privileges"; pub const TABLE_PRIVILEGES: &str = "table_privileges"; pub const TRIGGERS: &str = "triggers"; -pub const SCHEMATA: &str = "schemata"; -pub const KEY_COLUMN_USAGE: &str = "key_column_usage"; diff --git a/tests/cases/standalone/common/show/show_databases_tables.result b/tests/cases/standalone/common/show/show_databases_tables.result index 76a69d56aa8b..58bbbf1a227f 100644 --- a/tests/cases/standalone/common/show/show_databases_tables.result +++ b/tests/cases/standalone/common/show/show_databases_tables.result @@ -32,7 +32,15 @@ show tables; | events | | files | | key_column_usage | +| optimizer_trace | +| parameters | +| profiling | +| referential_constraints | +| routines | +| schema_privileges | | schemata | +| table_privileges | | tables | +| triggers | +---------------------------------------+ diff --git a/tests/cases/standalone/common/system/information_schema.result b/tests/cases/standalone/common/system/information_schema.result index a119b028a344..5270de7be2ed 100644 --- a/tests/cases/standalone/common/system/information_schema.result +++ b/tests/cases/standalone/common/system/information_schema.result @@ -24,151 +24,272 @@ order by table_schema, table_name; | greptime | information_schema | events | LOCAL TEMPORARY | 13 | | | greptime | information_schema | files | LOCAL TEMPORARY | 14 | | | greptime | information_schema | key_column_usage | LOCAL TEMPORARY | 16 | | +| greptime | information_schema | optimizer_trace | LOCAL TEMPORARY | 17 | | +| greptime | information_schema | parameters | LOCAL TEMPORARY | 18 | | +| greptime | information_schema | profiling | LOCAL TEMPORARY | 19 | | +| greptime | information_schema | referential_constraints | LOCAL TEMPORARY | 20 | | +| greptime | information_schema | routines | LOCAL TEMPORARY | 21 | | +| greptime | information_schema | schema_privileges | LOCAL TEMPORARY | 22 | | | greptime | information_schema | schemata | LOCAL TEMPORARY | 15 | | +| greptime | information_schema | table_privileges | LOCAL TEMPORARY | 23 | | | greptime | information_schema | tables | LOCAL TEMPORARY | 3 | | +| greptime | information_schema | triggers | LOCAL TEMPORARY | 24 | | | greptime | public | numbers | LOCAL TEMPORARY | 2 | test_engine | +---------------+--------------------+---------------------------------------+-----------------+----------+-------------+ select * from information_schema.columns order by table_schema, table_name; -+---------------+--------------------+---------------------------------------+-------------------------------+-----------+---------------+----------------+-------------+-------------+----------------+ -| table_catalog | table_schema | table_name | column_name | data_type | semantic_type | column_default | is_nullable | column_type | column_comment | -+---------------+--------------------+---------------------------------------+-------------------------------+-----------+---------------+----------------+-------------+-------------+----------------+ -| greptime | information_schema | build_info | git_branch | String | FIELD | | No | String | | -| greptime | information_schema | build_info | git_commit | String | FIELD | | No | String | | -| greptime | information_schema | build_info | git_commit_short | String | FIELD | | No | String | | -| greptime | information_schema | build_info | git_dirty | String | FIELD | | No | String | | -| greptime | information_schema | build_info | pkg_version | String | FIELD | | No | String | | -| greptime | information_schema | character_sets | description | String | FIELD | | No | String | | -| greptime | information_schema | character_sets | character_set_name | String | FIELD | | No | String | | -| greptime | information_schema | character_sets | default_collate_name | String | FIELD | | No | String | | -| greptime | information_schema | character_sets | maxlen | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | check_constraints | check_clause | String | FIELD | | No | String | | -| greptime | information_schema | check_constraints | constraint_name | String | FIELD | | No | String | | -| greptime | information_schema | check_constraints | constraint_schema | String | FIELD | | No | String | | -| greptime | information_schema | check_constraints | constraint_catalog | String | FIELD | | No | String | | -| greptime | information_schema | collation_character_set_applicability | character_set_name | String | FIELD | | No | String | | -| greptime | information_schema | collation_character_set_applicability | collation_name | String | FIELD | | No | String | | -| greptime | information_schema | collations | collation_name | String | FIELD | | No | String | | -| greptime | information_schema | collations | character_set_name | String | FIELD | | No | String | | -| greptime | information_schema | collations | id | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | collations | is_default | String | FIELD | | No | String | | -| greptime | information_schema | collations | is_compiled | String | FIELD | | No | String | | -| greptime | information_schema | collations | sortlen | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | column_privileges | table_schema | String | FIELD | | No | String | | -| greptime | information_schema | column_privileges | grantee | String | FIELD | | No | String | | -| greptime | information_schema | column_privileges | table_catalog | String | FIELD | | No | String | | -| greptime | information_schema | column_privileges | table_name | String | FIELD | | No | String | | -| greptime | information_schema | column_privileges | column_name | String | FIELD | | No | String | | -| greptime | information_schema | column_privileges | privilege_type | String | FIELD | | No | String | | -| greptime | information_schema | column_privileges | is_grantable | String | FIELD | | No | String | | -| greptime | information_schema | column_statistics | histogram | String | FIELD | | No | String | | -| greptime | information_schema | column_statistics | schema_name | String | FIELD | | No | String | | -| greptime | information_schema | column_statistics | table_name | String | FIELD | | No | String | | -| greptime | information_schema | column_statistics | column_name | String | FIELD | | No | String | | -| greptime | information_schema | columns | column_type | String | FIELD | | No | String | | -| greptime | information_schema | columns | table_catalog | String | FIELD | | No | String | | -| greptime | information_schema | columns | column_comment | String | FIELD | | Yes | String | | -| greptime | information_schema | columns | is_nullable | String | FIELD | | No | String | | -| greptime | information_schema | columns | column_default | String | FIELD | | Yes | String | | -| greptime | information_schema | columns | semantic_type | String | FIELD | | No | String | | -| greptime | information_schema | columns | data_type | String | FIELD | | No | String | | -| greptime | information_schema | columns | column_name | String | FIELD | | No | String | | -| greptime | information_schema | columns | table_name | String | FIELD | | No | String | | -| greptime | information_schema | columns | table_schema | String | FIELD | | No | String | | -| greptime | information_schema | engines | xa | String | FIELD | | No | String | | -| greptime | information_schema | engines | transactions | String | FIELD | | No | String | | -| greptime | information_schema | engines | comment | String | FIELD | | No | String | | -| greptime | information_schema | engines | support | String | FIELD | | No | String | | -| greptime | information_schema | engines | engine | String | FIELD | | No | String | | -| greptime | information_schema | engines | savepoints | String | FIELD | | No | String | | -| greptime | information_schema | events | starts | DateTime | FIELD | | No | DateTime | | -| greptime | information_schema | events | event_comment | String | FIELD | | No | String | | -| greptime | information_schema | events | database_collation | String | FIELD | | No | String | | -| greptime | information_schema | events | collation_connection | String | FIELD | | No | String | | -| greptime | information_schema | events | character_set_client | String | FIELD | | No | String | | -| greptime | information_schema | events | originator | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | events | event_catalog | String | FIELD | | No | String | | -| greptime | information_schema | events | event_schema | String | FIELD | | No | String | | -| greptime | information_schema | events | event_name | String | FIELD | | No | String | | -| greptime | information_schema | events | definer | String | FIELD | | No | String | | -| greptime | information_schema | events | time_zone | String | FIELD | | No | String | | -| greptime | information_schema | events | event_body | String | FIELD | | No | String | | -| greptime | information_schema | events | event_definition | String | FIELD | | No | String | | -| greptime | information_schema | events | event_type | String | FIELD | | No | String | | -| greptime | information_schema | events | execute_at | DateTime | FIELD | | No | DateTime | | -| greptime | information_schema | events | interval_value | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | events | interval_field | String | FIELD | | No | String | | -| greptime | information_schema | events | sql_mode | String | FIELD | | No | String | | -| greptime | information_schema | events | ends | DateTime | FIELD | | No | DateTime | | -| greptime | information_schema | events | status | String | FIELD | | No | String | | -| greptime | information_schema | events | on_completion | String | FIELD | | No | String | | -| greptime | information_schema | events | created | DateTime | FIELD | | No | DateTime | | -| greptime | information_schema | events | last_altered | DateTime | FIELD | | No | DateTime | | -| greptime | information_schema | events | last_executed | DateTime | FIELD | | No | DateTime | | -| greptime | information_schema | files | free_extents | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | files | row_format | String | FIELD | | No | String | | -| greptime | information_schema | files | extra | String | FIELD | | No | String | | -| greptime | information_schema | files | status | String | FIELD | | No | String | | -| greptime | information_schema | files | checksum | String | FIELD | | No | String | | -| greptime | information_schema | files | check_time | DateTime | FIELD | | No | DateTime | | -| greptime | information_schema | files | file_id | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | files | file_name | String | FIELD | | No | String | | -| greptime | information_schema | files | file_type | String | FIELD | | No | String | | -| greptime | information_schema | files | tablespace_name | String | FIELD | | No | String | | -| greptime | information_schema | files | table_catalog | String | FIELD | | No | String | | -| greptime | information_schema | files | table_schema | String | FIELD | | No | String | | -| greptime | information_schema | files | table_name | String | FIELD | | No | String | | -| greptime | information_schema | files | logfile_group_name | String | FIELD | | No | String | | -| greptime | information_schema | files | logfile_group_number | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | files | engine | String | FIELD | | No | String | | -| greptime | information_schema | files | fulltext_keys | String | FIELD | | No | String | | -| greptime | information_schema | files | deleted_rows | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | files | update_count | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | files | update_time | DateTime | FIELD | | No | DateTime | | -| greptime | information_schema | files | total_extents | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | files | extent_size | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | files | initial_size | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | files | maximum_size | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | files | autoextend_size | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | files | creation_time | DateTime | FIELD | | No | DateTime | | -| greptime | information_schema | files | last_update_time | DateTime | FIELD | | No | DateTime | | -| greptime | information_schema | files | last_access_time | DateTime | FIELD | | No | DateTime | | -| greptime | information_schema | files | recover_time | DateTime | FIELD | | No | DateTime | | -| greptime | information_schema | files | transaction_counter | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | files | version | String | FIELD | | No | String | | -| greptime | information_schema | files | create_time | DateTime | FIELD | | No | DateTime | | -| greptime | information_schema | files | table_rows | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | files | avg_row_length | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | files | data_length | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | files | max_data_length | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | files | index_length | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | files | data_free | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | key_column_usage | ordinal_position | UInt32 | FIELD | | No | UInt32 | | -| greptime | information_schema | key_column_usage | constraint_schema | String | FIELD | | No | String | | -| greptime | information_schema | key_column_usage | referenced_column_name | String | FIELD | | Yes | String | | -| greptime | information_schema | key_column_usage | referenced_table_name | String | FIELD | | Yes | String | | -| greptime | information_schema | key_column_usage | referenced_table_schema | String | FIELD | | Yes | String | | -| greptime | information_schema | key_column_usage | position_in_unique_constraint | UInt32 | FIELD | | Yes | UInt32 | | -| greptime | information_schema | key_column_usage | constraint_catalog | String | FIELD | | No | String | | -| greptime | information_schema | key_column_usage | column_name | String | FIELD | | No | String | | -| greptime | information_schema | key_column_usage | table_schema | String | FIELD | | No | String | | -| greptime | information_schema | key_column_usage | table_catalog | String | FIELD | | No | String | | -| greptime | information_schema | key_column_usage | constraint_name | String | FIELD | | No | String | | -| greptime | information_schema | key_column_usage | table_name | String | FIELD | | No | String | | -| greptime | information_schema | schemata | catalog_name | String | FIELD | | No | String | | -| greptime | information_schema | schemata | default_collation_name | String | FIELD | | No | String | | -| greptime | information_schema | schemata | default_character_set_name | String | FIELD | | No | String | | -| greptime | information_schema | schemata | sql_path | String | FIELD | | Yes | String | | -| greptime | information_schema | schemata | schema_name | String | FIELD | | No | String | | -| greptime | information_schema | tables | table_schema | String | FIELD | | No | String | | -| greptime | information_schema | tables | table_catalog | String | FIELD | | No | String | | -| greptime | information_schema | tables | engine | String | FIELD | | Yes | String | | -| greptime | information_schema | tables | table_name | String | FIELD | | No | String | | -| greptime | information_schema | tables | table_type | String | FIELD | | No | String | | -| greptime | information_schema | tables | table_id | UInt32 | FIELD | | Yes | UInt32 | | -| greptime | public | numbers | number | UInt32 | TAG | | No | UInt32 | | -+---------------+--------------------+---------------------------------------+-------------------------------+-----------+---------------+----------------+-------------+-------------+----------------+ ++---------------+--------------------+---------------------------------------+-----------------------------------+-----------+---------------+----------------+-------------+-------------+----------------+ +| table_catalog | table_schema | table_name | column_name | data_type | semantic_type | column_default | is_nullable | column_type | column_comment | ++---------------+--------------------+---------------------------------------+-----------------------------------+-----------+---------------+----------------+-------------+-------------+----------------+ +| greptime | information_schema | build_info | git_branch | String | FIELD | | No | String | | +| greptime | information_schema | build_info | git_commit | String | FIELD | | No | String | | +| greptime | information_schema | build_info | git_commit_short | String | FIELD | | No | String | | +| greptime | information_schema | build_info | git_dirty | String | FIELD | | No | String | | +| greptime | information_schema | build_info | pkg_version | String | FIELD | | No | String | | +| greptime | information_schema | character_sets | default_collate_name | String | FIELD | | No | String | | +| greptime | information_schema | character_sets | character_set_name | String | FIELD | | No | String | | +| greptime | information_schema | character_sets | maxlen | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | character_sets | description | String | FIELD | | No | String | | +| greptime | information_schema | check_constraints | check_clause | String | FIELD | | No | String | | +| greptime | information_schema | check_constraints | constraint_name | String | FIELD | | No | String | | +| greptime | information_schema | check_constraints | constraint_schema | String | FIELD | | No | String | | +| greptime | information_schema | check_constraints | constraint_catalog | String | FIELD | | No | String | | +| greptime | information_schema | collation_character_set_applicability | character_set_name | String | FIELD | | No | String | | +| greptime | information_schema | collation_character_set_applicability | collation_name | String | FIELD | | No | String | | +| greptime | information_schema | collations | collation_name | String | FIELD | | No | String | | +| greptime | information_schema | collations | sortlen | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | collations | character_set_name | String | FIELD | | No | String | | +| greptime | information_schema | collations | id | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | collations | is_default | String | FIELD | | No | String | | +| greptime | information_schema | collations | is_compiled | String | FIELD | | No | String | | +| greptime | information_schema | column_privileges | table_schema | String | FIELD | | No | String | | +| greptime | information_schema | column_privileges | table_catalog | String | FIELD | | No | String | | +| greptime | information_schema | column_privileges | grantee | String | FIELD | | No | String | | +| greptime | information_schema | column_privileges | table_name | String | FIELD | | No | String | | +| greptime | information_schema | column_privileges | column_name | String | FIELD | | No | String | | +| greptime | information_schema | column_privileges | privilege_type | String | FIELD | | No | String | | +| greptime | information_schema | column_privileges | is_grantable | String | FIELD | | No | String | | +| greptime | information_schema | column_statistics | histogram | String | FIELD | | No | String | | +| greptime | information_schema | column_statistics | schema_name | String | FIELD | | No | String | | +| greptime | information_schema | column_statistics | table_name | String | FIELD | | No | String | | +| greptime | information_schema | column_statistics | column_name | String | FIELD | | No | String | | +| greptime | information_schema | columns | column_type | String | FIELD | | No | String | | +| greptime | information_schema | columns | column_comment | String | FIELD | | Yes | String | | +| greptime | information_schema | columns | table_name | String | FIELD | | No | String | | +| greptime | information_schema | columns | is_nullable | String | FIELD | | No | String | | +| greptime | information_schema | columns | column_default | String | FIELD | | Yes | String | | +| greptime | information_schema | columns | semantic_type | String | FIELD | | No | String | | +| greptime | information_schema | columns | table_schema | String | FIELD | | No | String | | +| greptime | information_schema | columns | table_catalog | String | FIELD | | No | String | | +| greptime | information_schema | columns | data_type | String | FIELD | | No | String | | +| greptime | information_schema | columns | column_name | String | FIELD | | No | String | | +| greptime | information_schema | engines | savepoints | String | FIELD | | No | String | | +| greptime | information_schema | engines | xa | String | FIELD | | No | String | | +| greptime | information_schema | engines | transactions | String | FIELD | | No | String | | +| greptime | information_schema | engines | comment | String | FIELD | | No | String | | +| greptime | information_schema | engines | support | String | FIELD | | No | String | | +| greptime | information_schema | engines | engine | String | FIELD | | No | String | | +| greptime | information_schema | events | event_catalog | String | FIELD | | No | String | | +| greptime | information_schema | events | last_executed | DateTime | FIELD | | No | DateTime | | +| greptime | information_schema | events | database_collation | String | FIELD | | No | String | | +| greptime | information_schema | events | collation_connection | String | FIELD | | No | String | | +| greptime | information_schema | events | character_set_client | String | FIELD | | No | String | | +| greptime | information_schema | events | originator | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | events | event_comment | String | FIELD | | No | String | | +| greptime | information_schema | events | event_schema | String | FIELD | | No | String | | +| greptime | information_schema | events | event_name | String | FIELD | | No | String | | +| greptime | information_schema | events | definer | String | FIELD | | No | String | | +| greptime | information_schema | events | time_zone | String | FIELD | | No | String | | +| greptime | information_schema | events | event_body | String | FIELD | | No | String | | +| greptime | information_schema | events | event_definition | String | FIELD | | No | String | | +| greptime | information_schema | events | event_type | String | FIELD | | No | String | | +| greptime | information_schema | events | execute_at | DateTime | FIELD | | No | DateTime | | +| greptime | information_schema | events | interval_value | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | events | interval_field | String | FIELD | | No | String | | +| greptime | information_schema | events | sql_mode | String | FIELD | | No | String | | +| greptime | information_schema | events | starts | DateTime | FIELD | | No | DateTime | | +| greptime | information_schema | events | ends | DateTime | FIELD | | No | DateTime | | +| greptime | information_schema | events | status | String | FIELD | | No | String | | +| greptime | information_schema | events | on_completion | String | FIELD | | No | String | | +| greptime | information_schema | events | created | DateTime | FIELD | | No | DateTime | | +| greptime | information_schema | events | last_altered | DateTime | FIELD | | No | DateTime | | +| greptime | information_schema | files | file_name | String | FIELD | | No | String | | +| greptime | information_schema | files | free_extents | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | files | extra | String | FIELD | | No | String | | +| greptime | information_schema | files | status | String | FIELD | | No | String | | +| greptime | information_schema | files | checksum | String | FIELD | | No | String | | +| greptime | information_schema | files | check_time | DateTime | FIELD | | No | DateTime | | +| greptime | information_schema | files | file_id | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | files | create_time | DateTime | FIELD | | No | DateTime | | +| greptime | information_schema | files | file_type | String | FIELD | | No | String | | +| greptime | information_schema | files | tablespace_name | String | FIELD | | No | String | | +| greptime | information_schema | files | table_catalog | String | FIELD | | No | String | | +| greptime | information_schema | files | table_schema | String | FIELD | | No | String | | +| greptime | information_schema | files | table_name | String | FIELD | | No | String | | +| greptime | information_schema | files | logfile_group_name | String | FIELD | | No | String | | +| greptime | information_schema | files | logfile_group_number | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | files | engine | String | FIELD | | No | String | | +| greptime | information_schema | files | fulltext_keys | String | FIELD | | No | String | | +| greptime | information_schema | files | deleted_rows | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | files | update_count | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | files | update_time | DateTime | FIELD | | No | DateTime | | +| greptime | information_schema | files | total_extents | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | files | extent_size | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | files | initial_size | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | files | maximum_size | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | files | autoextend_size | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | files | creation_time | DateTime | FIELD | | No | DateTime | | +| greptime | information_schema | files | last_update_time | DateTime | FIELD | | No | DateTime | | +| greptime | information_schema | files | last_access_time | DateTime | FIELD | | No | DateTime | | +| greptime | information_schema | files | recover_time | DateTime | FIELD | | No | DateTime | | +| greptime | information_schema | files | transaction_counter | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | files | version | String | FIELD | | No | String | | +| greptime | information_schema | files | row_format | String | FIELD | | No | String | | +| greptime | information_schema | files | table_rows | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | files | avg_row_length | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | files | data_length | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | files | max_data_length | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | files | index_length | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | files | data_free | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | key_column_usage | constraint_schema | String | FIELD | | No | String | | +| greptime | information_schema | key_column_usage | constraint_name | String | FIELD | | No | String | | +| greptime | information_schema | key_column_usage | referenced_column_name | String | FIELD | | Yes | String | | +| greptime | information_schema | key_column_usage | referenced_table_name | String | FIELD | | Yes | String | | +| greptime | information_schema | key_column_usage | referenced_table_schema | String | FIELD | | Yes | String | | +| greptime | information_schema | key_column_usage | position_in_unique_constraint | UInt32 | FIELD | | Yes | UInt32 | | +| greptime | information_schema | key_column_usage | ordinal_position | UInt32 | FIELD | | No | UInt32 | | +| greptime | information_schema | key_column_usage | column_name | String | FIELD | | No | String | | +| greptime | information_schema | key_column_usage | table_name | String | FIELD | | No | String | | +| greptime | information_schema | key_column_usage | table_schema | String | FIELD | | No | String | | +| greptime | information_schema | key_column_usage | table_catalog | String | FIELD | | No | String | | +| greptime | information_schema | key_column_usage | constraint_catalog | String | FIELD | | No | String | | +| greptime | information_schema | optimizer_trace | missing_bytes_beyond_max_mem_size | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | optimizer_trace | query | String | FIELD | | No | String | | +| greptime | information_schema | optimizer_trace | insufficient_privileges | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | optimizer_trace | trace | String | FIELD | | No | String | | +| greptime | information_schema | parameters | collation_name | String | FIELD | | No | String | | +| greptime | information_schema | parameters | dtd_identifier | String | FIELD | | No | String | | +| greptime | information_schema | parameters | routine_type | String | FIELD | | No | String | | +| greptime | information_schema | parameters | parameter_name | String | FIELD | | No | String | | +| greptime | information_schema | parameters | character_set_name | String | FIELD | | No | String | | +| greptime | information_schema | parameters | datetime_precision | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | parameters | numeric_scale | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | parameters | numeric_precision | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | parameters | character_octet_length | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | parameters | data_type | String | FIELD | | No | String | | +| greptime | information_schema | parameters | character_maximum_length | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | parameters | specific_catalog | String | FIELD | | No | String | | +| greptime | information_schema | parameters | specific_schema | String | FIELD | | No | String | | +| greptime | information_schema | parameters | specific_name | String | FIELD | | No | String | | +| greptime | information_schema | parameters | ordinal_position | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | parameters | parameter_mode | String | FIELD | | No | String | | +| greptime | information_schema | profiling | messages_received | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | profiling | context_involuntary | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | profiling | block_ops_out | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | profiling | messages_sent | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | profiling | source_line | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | profiling | source_file | String | FIELD | | No | String | | +| greptime | information_schema | profiling | source_function | String | FIELD | | No | String | | +| greptime | information_schema | profiling | swaps | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | profiling | block_ops_in | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | profiling | page_faults_minor | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | profiling | page_faults_major | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | profiling | query_id | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | profiling | seq | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | profiling | state | String | FIELD | | No | String | | +| greptime | information_schema | profiling | duration | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | profiling | cpu_user | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | profiling | cpu_system | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | profiling | context_voluntary | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | referential_constraints | delete_rule | String | FIELD | | No | String | | +| greptime | information_schema | referential_constraints | constraint_catalog | String | FIELD | | No | String | | +| greptime | information_schema | referential_constraints | referenced_table_name | String | FIELD | | No | String | | +| greptime | information_schema | referential_constraints | table_name | String | FIELD | | No | String | | +| greptime | information_schema | referential_constraints | update_rule | String | FIELD | | No | String | | +| greptime | information_schema | referential_constraints | match_option | String | FIELD | | No | String | | +| greptime | information_schema | referential_constraints | unique_constraint_name | String | FIELD | | No | String | | +| greptime | information_schema | referential_constraints | unique_constraint_schema | String | FIELD | | No | String | | +| greptime | information_schema | referential_constraints | unique_constraint_catalog | String | FIELD | | No | String | | +| greptime | information_schema | referential_constraints | constraint_name | String | FIELD | | No | String | | +| greptime | information_schema | referential_constraints | constraint_schema | String | FIELD | | No | String | | +| greptime | information_schema | routines | sql_path | String | FIELD | | No | String | | +| greptime | information_schema | routines | routine_comment | String | FIELD | | No | String | | +| greptime | information_schema | routines | database_collation | String | FIELD | | No | String | | +| greptime | information_schema | routines | collation_connection | String | FIELD | | No | String | | +| greptime | information_schema | routines | character_set_client | String | FIELD | | No | String | | +| greptime | information_schema | routines | definer | String | FIELD | | No | String | | +| greptime | information_schema | routines | sql_mode | String | FIELD | | No | String | | +| greptime | information_schema | routines | last_altered | DateTime | FIELD | | No | DateTime | | +| greptime | information_schema | routines | created | DateTime | FIELD | | No | DateTime | | +| greptime | information_schema | routines | security_type | String | FIELD | | No | String | | +| greptime | information_schema | routines | sql_data_access | String | FIELD | | No | String | | +| greptime | information_schema | routines | specific_name | String | FIELD | | No | String | | +| greptime | information_schema | routines | routine_catalog | String | FIELD | | No | String | | +| greptime | information_schema | routines | routine_schema | String | FIELD | | No | String | | +| greptime | information_schema | routines | routine_name | String | FIELD | | No | String | | +| greptime | information_schema | routines | routine_type | String | FIELD | | No | String | | +| greptime | information_schema | routines | data_type | String | FIELD | | No | String | | +| greptime | information_schema | routines | character_maximum_length | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | routines | character_octet_length | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | routines | numeric_precision | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | routines | numeric_scale | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | routines | datetime_precision | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | routines | character_set_name | String | FIELD | | No | String | | +| greptime | information_schema | routines | collation_name | String | FIELD | | No | String | | +| greptime | information_schema | routines | dtd_identifier | String | FIELD | | No | String | | +| greptime | information_schema | routines | routine_body | String | FIELD | | No | String | | +| greptime | information_schema | routines | routine_definition | String | FIELD | | No | String | | +| greptime | information_schema | routines | external_name | String | FIELD | | No | String | | +| greptime | information_schema | routines | external_language | String | FIELD | | No | String | | +| greptime | information_schema | routines | parameter_style | String | FIELD | | No | String | | +| greptime | information_schema | routines | is_deterministic | String | FIELD | | No | String | | +| greptime | information_schema | schema_privileges | grantee | String | FIELD | | No | String | | +| greptime | information_schema | schema_privileges | is_grantable | String | FIELD | | No | String | | +| greptime | information_schema | schema_privileges | privilege_type | String | FIELD | | No | String | | +| greptime | information_schema | schema_privileges | table_schema | String | FIELD | | No | String | | +| greptime | information_schema | schema_privileges | table_catalog | String | FIELD | | No | String | | +| greptime | information_schema | schemata | schema_name | String | FIELD | | No | String | | +| greptime | information_schema | schemata | catalog_name | String | FIELD | | No | String | | +| greptime | information_schema | schemata | sql_path | String | FIELD | | Yes | String | | +| greptime | information_schema | schemata | default_character_set_name | String | FIELD | | No | String | | +| greptime | information_schema | schemata | default_collation_name | String | FIELD | | No | String | | +| greptime | information_schema | table_privileges | grantee | String | FIELD | | No | String | | +| greptime | information_schema | table_privileges | table_catalog | String | FIELD | | No | String | | +| greptime | information_schema | table_privileges | table_schema | String | FIELD | | No | String | | +| greptime | information_schema | table_privileges | table_name | String | FIELD | | No | String | | +| greptime | information_schema | table_privileges | privilege_type | String | FIELD | | No | String | | +| greptime | information_schema | table_privileges | is_grantable | String | FIELD | | No | String | | +| greptime | information_schema | tables | table_schema | String | FIELD | | No | String | | +| greptime | information_schema | tables | table_name | String | FIELD | | No | String | | +| greptime | information_schema | tables | table_type | String | FIELD | | No | String | | +| greptime | information_schema | tables | table_id | UInt32 | FIELD | | Yes | UInt32 | | +| greptime | information_schema | tables | engine | String | FIELD | | Yes | String | | +| greptime | information_schema | tables | table_catalog | String | FIELD | | No | String | | +| greptime | information_schema | triggers | trigger_catalog | String | FIELD | | No | String | | +| greptime | information_schema | triggers | trigger_schema | String | FIELD | | No | String | | +| greptime | information_schema | triggers | trigger_name | String | FIELD | | No | String | | +| greptime | information_schema | triggers | event_manipulation | String | FIELD | | No | String | | +| greptime | information_schema | triggers | event_object_catalog | String | FIELD | | No | String | | +| greptime | information_schema | triggers | event_object_schema | String | FIELD | | No | String | | +| greptime | information_schema | triggers | event_object_table | String | FIELD | | No | String | | +| greptime | information_schema | triggers | action_order | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | triggers | action_condition | String | FIELD | | No | String | | +| greptime | information_schema | triggers | action_statement | String | FIELD | | No | String | | +| greptime | information_schema | triggers | action_orientation | String | FIELD | | No | String | | +| greptime | information_schema | triggers | action_timing | String | FIELD | | No | String | | +| greptime | information_schema | triggers | action_reference_old_table | String | FIELD | | No | String | | +| greptime | information_schema | triggers | action_reference_new_table | String | FIELD | | No | String | | +| greptime | information_schema | triggers | action_reference_old_row | String | FIELD | | No | String | | +| greptime | information_schema | triggers | action_reference_new_row | String | FIELD | | No | String | | +| greptime | information_schema | triggers | created | DateTime | FIELD | | No | DateTime | | +| greptime | information_schema | triggers | sql_mode | String | FIELD | | No | String | | +| greptime | information_schema | triggers | definer | String | FIELD | | No | String | | +| greptime | information_schema | triggers | character_set_client | String | FIELD | | No | String | | +| greptime | information_schema | triggers | collation_connection | String | FIELD | | No | String | | +| greptime | information_schema | triggers | database_collation | String | FIELD | | No | String | | +| greptime | public | numbers | number | UInt32 | TAG | | No | UInt32 | | ++---------------+--------------------+---------------------------------------+-----------------------------------+-----------+---------------+----------------+-------------+-------------+----------------+ create database my_db; From b55fd6cc2887b99b939b8ee8676b96cdd0426fa4 Mon Sep 17 00:00:00 2001 From: test Date: Mon, 1 Jan 2024 00:43:53 +0800 Subject: [PATCH 10/14] feat: add information_schema.global_status --- src/catalog/src/information_schema.rs | 2 ++ src/catalog/src/information_schema/memory_table/tables.rs | 8 ++++++++ src/catalog/src/information_schema/table_names.rs | 1 + src/common/catalog/src/consts.rs | 2 ++ 4 files changed, 13 insertions(+) diff --git a/src/catalog/src/information_schema.rs b/src/catalog/src/information_schema.rs index 4142d39f99fb..7b29acc0f243 100644 --- a/src/catalog/src/information_schema.rs +++ b/src/catalog/src/information_schema.rs @@ -69,6 +69,7 @@ lazy_static! { SCHEMA_PRIVILEGES, TABLE_PRIVILEGES, TRIGGERS, + GLOBAL_STATUS, ]; } @@ -195,6 +196,7 @@ impl InformationSchemaProvider { SCHEMA_PRIVILEGES => setup_memory_table!(SCHEMA_PRIVILEGES), TABLE_PRIVILEGES => setup_memory_table!(TABLE_PRIVILEGES), TRIGGERS => setup_memory_table!(TRIGGERS), + GLOBAL_STATUS => setup_memory_table!(GLOBAL_STATUS), KEY_COLUMN_USAGE => Some(Arc::new(InformationSchemaKeyColumnUsage::new( self.catalog_name.clone(), self.catalog_manager.clone(), diff --git a/src/catalog/src/information_schema/memory_table/tables.rs b/src/catalog/src/information_schema/memory_table/tables.rs index 26780a28dca1..705a598d2873 100644 --- a/src/catalog/src/information_schema/memory_table/tables.rs +++ b/src/catalog/src/information_schema/memory_table/tables.rs @@ -392,6 +392,14 @@ pub fn get_schema_columns(table_name: &str) -> (SchemaRef, Vec) { vec![], ), + GLOBAL_STATUS => ( + vec![ + string_column("VARIABLE_NAME"), + string_column("VARIABLE_VALUE"), + ], + vec![], + ), + _ => unreachable!("Unknown table in information_schema: {}", table_name), }; diff --git a/src/catalog/src/information_schema/table_names.rs b/src/catalog/src/information_schema/table_names.rs index c119598816e1..482ee0e8847d 100644 --- a/src/catalog/src/information_schema/table_names.rs +++ b/src/catalog/src/information_schema/table_names.rs @@ -35,4 +35,5 @@ pub const REFERENTIAL_CONSTRAINTS: &str = "referential_constraints"; pub const ROUTINES: &str = "routines"; pub const SCHEMA_PRIVILEGES: &str = "schema_privileges"; pub const TABLE_PRIVILEGES: &str = "table_privileges"; +pub const GLOBAL_STATUS: &str = "global_status"; pub const TRIGGERS: &str = "triggers"; diff --git a/src/common/catalog/src/consts.rs b/src/common/catalog/src/consts.rs index a6dcbd6d33dc..c3ace8acd534 100644 --- a/src/common/catalog/src/consts.rs +++ b/src/common/catalog/src/consts.rs @@ -76,6 +76,8 @@ pub const INFORMATION_SCHEMA_SCHEMA_PRIVILEGES_TABLE_ID: u32 = 22; pub const INFORMATION_SCHEMA_TABLE_PRIVILEGES_TABLE_ID: u32 = 23; /// id for information_schema.TRIGGERS pub const INFORMATION_SCHEMA_TRIGGERS_TABLE_ID: u32 = 24; +/// id for information_schema.GLOBAL_STATUS +pub const INFORMATION_SCHEMA_GLOBAL_STATUS_TABLE_ID: u32 = 25; /// ----- End of information_schema tables ----- pub const MITO_ENGINE: &str = "mito"; From 780217fa53dff04380be45dc0766a04d939b991f Mon Sep 17 00:00:00 2001 From: test Date: Mon, 1 Jan 2024 00:47:20 +0800 Subject: [PATCH 11/14] feat: add information_schema.session_status --- src/catalog/src/information_schema.rs | 2 ++ src/catalog/src/information_schema/memory_table/tables.rs | 8 ++++++++ src/catalog/src/information_schema/table_names.rs | 3 ++- src/common/catalog/src/consts.rs | 2 ++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/catalog/src/information_schema.rs b/src/catalog/src/information_schema.rs index 7b29acc0f243..7dbc71f6f465 100644 --- a/src/catalog/src/information_schema.rs +++ b/src/catalog/src/information_schema.rs @@ -70,6 +70,7 @@ lazy_static! { TABLE_PRIVILEGES, TRIGGERS, GLOBAL_STATUS, + SESSION_STATUS, ]; } @@ -197,6 +198,7 @@ impl InformationSchemaProvider { TABLE_PRIVILEGES => setup_memory_table!(TABLE_PRIVILEGES), TRIGGERS => setup_memory_table!(TRIGGERS), GLOBAL_STATUS => setup_memory_table!(GLOBAL_STATUS), + SESSION_STATUS => setup_memory_table!(SESSION_STATUS), KEY_COLUMN_USAGE => Some(Arc::new(InformationSchemaKeyColumnUsage::new( self.catalog_name.clone(), self.catalog_manager.clone(), diff --git a/src/catalog/src/information_schema/memory_table/tables.rs b/src/catalog/src/information_schema/memory_table/tables.rs index 705a598d2873..7598bca7a23a 100644 --- a/src/catalog/src/information_schema/memory_table/tables.rs +++ b/src/catalog/src/information_schema/memory_table/tables.rs @@ -400,6 +400,14 @@ pub fn get_schema_columns(table_name: &str) -> (SchemaRef, Vec) { vec![], ), + SESSION_STATUS => ( + vec![ + string_column("VARIABLE_NAME"), + string_column("VARIABLE_VALUE"), + ], + vec![], + ), + _ => unreachable!("Unknown table in information_schema: {}", table_name), }; diff --git a/src/catalog/src/information_schema/table_names.rs b/src/catalog/src/information_schema/table_names.rs index 482ee0e8847d..ce252e2e47dd 100644 --- a/src/catalog/src/information_schema/table_names.rs +++ b/src/catalog/src/information_schema/table_names.rs @@ -35,5 +35,6 @@ pub const REFERENTIAL_CONSTRAINTS: &str = "referential_constraints"; pub const ROUTINES: &str = "routines"; pub const SCHEMA_PRIVILEGES: &str = "schema_privileges"; pub const TABLE_PRIVILEGES: &str = "table_privileges"; -pub const GLOBAL_STATUS: &str = "global_status"; pub const TRIGGERS: &str = "triggers"; +pub const GLOBAL_STATUS: &str = "global_status"; +pub const SESSION_STATUS: &str = "session_status"; diff --git a/src/common/catalog/src/consts.rs b/src/common/catalog/src/consts.rs index c3ace8acd534..3e0510cd9215 100644 --- a/src/common/catalog/src/consts.rs +++ b/src/common/catalog/src/consts.rs @@ -78,6 +78,8 @@ pub const INFORMATION_SCHEMA_TABLE_PRIVILEGES_TABLE_ID: u32 = 23; pub const INFORMATION_SCHEMA_TRIGGERS_TABLE_ID: u32 = 24; /// id for information_schema.GLOBAL_STATUS pub const INFORMATION_SCHEMA_GLOBAL_STATUS_TABLE_ID: u32 = 25; +/// id for information_schema.SESSION_STATUS +pub const INFORMATION_SCHEMA_SESSION_STATUS_TABLE_ID: u32 = 26; /// ----- End of information_schema tables ----- pub const MITO_ENGINE: &str = "mito"; From 57d090758d69dca324cf9f361fed35f515215c87 Mon Sep 17 00:00:00 2001 From: test Date: Mon, 1 Jan 2024 00:52:07 +0800 Subject: [PATCH 12/14] fix: update sql test result --- .../common/show/show_databases_tables.result | 2 + .../common/system/information_schema.result | 106 +++++++++--------- 2 files changed, 58 insertions(+), 50 deletions(-) diff --git a/tests/cases/standalone/common/show/show_databases_tables.result b/tests/cases/standalone/common/show/show_databases_tables.result index 58bbbf1a227f..0f5615222726 100644 --- a/tests/cases/standalone/common/show/show_databases_tables.result +++ b/tests/cases/standalone/common/show/show_databases_tables.result @@ -31,6 +31,7 @@ show tables; | engines | | events | | files | +| global_status | | key_column_usage | | optimizer_trace | | parameters | @@ -39,6 +40,7 @@ show tables; | routines | | schema_privileges | | schemata | +| session_status | | table_privileges | | tables | | triggers | diff --git a/tests/cases/standalone/common/system/information_schema.result b/tests/cases/standalone/common/system/information_schema.result index 5270de7be2ed..2243265bf3a9 100644 --- a/tests/cases/standalone/common/system/information_schema.result +++ b/tests/cases/standalone/common/system/information_schema.result @@ -23,6 +23,7 @@ order by table_schema, table_name; | greptime | information_schema | engines | LOCAL TEMPORARY | 5 | | | greptime | information_schema | events | LOCAL TEMPORARY | 13 | | | greptime | information_schema | files | LOCAL TEMPORARY | 14 | | +| greptime | information_schema | global_status | LOCAL TEMPORARY | 25 | | | greptime | information_schema | key_column_usage | LOCAL TEMPORARY | 16 | | | greptime | information_schema | optimizer_trace | LOCAL TEMPORARY | 17 | | | greptime | information_schema | parameters | LOCAL TEMPORARY | 18 | | @@ -31,6 +32,7 @@ order by table_schema, table_name; | greptime | information_schema | routines | LOCAL TEMPORARY | 21 | | | greptime | information_schema | schema_privileges | LOCAL TEMPORARY | 22 | | | greptime | information_schema | schemata | LOCAL TEMPORARY | 15 | | +| greptime | information_schema | session_status | LOCAL TEMPORARY | 26 | | | greptime | information_schema | table_privileges | LOCAL TEMPORARY | 23 | | | greptime | information_schema | tables | LOCAL TEMPORARY | 3 | | | greptime | information_schema | triggers | LOCAL TEMPORARY | 24 | | @@ -47,19 +49,19 @@ select * from information_schema.columns order by table_schema, table_name; | greptime | information_schema | build_info | git_commit_short | String | FIELD | | No | String | | | greptime | information_schema | build_info | git_dirty | String | FIELD | | No | String | | | greptime | information_schema | build_info | pkg_version | String | FIELD | | No | String | | -| greptime | information_schema | character_sets | default_collate_name | String | FIELD | | No | String | | -| greptime | information_schema | character_sets | character_set_name | String | FIELD | | No | String | | | greptime | information_schema | character_sets | maxlen | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | character_sets | character_set_name | String | FIELD | | No | String | | +| greptime | information_schema | character_sets | default_collate_name | String | FIELD | | No | String | | | greptime | information_schema | character_sets | description | String | FIELD | | No | String | | | greptime | information_schema | check_constraints | check_clause | String | FIELD | | No | String | | -| greptime | information_schema | check_constraints | constraint_name | String | FIELD | | No | String | | -| greptime | information_schema | check_constraints | constraint_schema | String | FIELD | | No | String | | | greptime | information_schema | check_constraints | constraint_catalog | String | FIELD | | No | String | | +| greptime | information_schema | check_constraints | constraint_schema | String | FIELD | | No | String | | +| greptime | information_schema | check_constraints | constraint_name | String | FIELD | | No | String | | | greptime | information_schema | collation_character_set_applicability | character_set_name | String | FIELD | | No | String | | | greptime | information_schema | collation_character_set_applicability | collation_name | String | FIELD | | No | String | | +| greptime | information_schema | collations | character_set_name | String | FIELD | | No | String | | | greptime | information_schema | collations | collation_name | String | FIELD | | No | String | | | greptime | information_schema | collations | sortlen | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | collations | character_set_name | String | FIELD | | No | String | | | greptime | information_schema | collations | id | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | collations | is_default | String | FIELD | | No | String | | | greptime | information_schema | collations | is_compiled | String | FIELD | | No | String | | @@ -80,8 +82,8 @@ select * from information_schema.columns order by table_schema, table_name; | greptime | information_schema | columns | is_nullable | String | FIELD | | No | String | | | greptime | information_schema | columns | column_default | String | FIELD | | Yes | String | | | greptime | information_schema | columns | semantic_type | String | FIELD | | No | String | | -| greptime | information_schema | columns | table_schema | String | FIELD | | No | String | | | greptime | information_schema | columns | table_catalog | String | FIELD | | No | String | | +| greptime | information_schema | columns | table_schema | String | FIELD | | No | String | | | greptime | information_schema | columns | data_type | String | FIELD | | No | String | | | greptime | information_schema | columns | column_name | String | FIELD | | No | String | | | greptime | information_schema | engines | savepoints | String | FIELD | | No | String | | @@ -90,15 +92,15 @@ select * from information_schema.columns order by table_schema, table_name; | greptime | information_schema | engines | comment | String | FIELD | | No | String | | | greptime | information_schema | engines | support | String | FIELD | | No | String | | | greptime | information_schema | engines | engine | String | FIELD | | No | String | | -| greptime | information_schema | events | event_catalog | String | FIELD | | No | String | | +| greptime | information_schema | events | event_name | String | FIELD | | No | String | | | greptime | information_schema | events | last_executed | DateTime | FIELD | | No | DateTime | | | greptime | information_schema | events | database_collation | String | FIELD | | No | String | | | greptime | information_schema | events | collation_connection | String | FIELD | | No | String | | | greptime | information_schema | events | character_set_client | String | FIELD | | No | String | | | greptime | information_schema | events | originator | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | events | event_comment | String | FIELD | | No | String | | +| greptime | information_schema | events | event_catalog | String | FIELD | | No | String | | | greptime | information_schema | events | event_schema | String | FIELD | | No | String | | -| greptime | information_schema | events | event_name | String | FIELD | | No | String | | +| greptime | information_schema | events | event_comment | String | FIELD | | No | String | | | greptime | information_schema | events | definer | String | FIELD | | No | String | | | greptime | information_schema | events | time_zone | String | FIELD | | No | String | | | greptime | information_schema | events | event_body | String | FIELD | | No | String | | @@ -116,12 +118,12 @@ select * from information_schema.columns order by table_schema, table_name; | greptime | information_schema | events | last_altered | DateTime | FIELD | | No | DateTime | | | greptime | information_schema | files | file_name | String | FIELD | | No | String | | | greptime | information_schema | files | free_extents | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | files | extra | String | FIELD | | No | String | | -| greptime | information_schema | files | status | String | FIELD | | No | String | | | greptime | information_schema | files | checksum | String | FIELD | | No | String | | -| greptime | information_schema | files | check_time | DateTime | FIELD | | No | DateTime | | -| greptime | information_schema | files | file_id | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | files | update_time | DateTime | FIELD | | No | DateTime | | | greptime | information_schema | files | create_time | DateTime | FIELD | | No | DateTime | | +| greptime | information_schema | files | status | String | FIELD | | No | String | | +| greptime | information_schema | files | file_id | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | files | check_time | DateTime | FIELD | | No | DateTime | | | greptime | information_schema | files | file_type | String | FIELD | | No | String | | | greptime | information_schema | files | tablespace_name | String | FIELD | | No | String | | | greptime | information_schema | files | table_catalog | String | FIELD | | No | String | | @@ -133,7 +135,7 @@ select * from information_schema.columns order by table_schema, table_name; | greptime | information_schema | files | fulltext_keys | String | FIELD | | No | String | | | greptime | information_schema | files | deleted_rows | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | files | update_count | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | files | update_time | DateTime | FIELD | | No | DateTime | | +| greptime | information_schema | files | extra | String | FIELD | | No | String | | | greptime | information_schema | files | total_extents | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | files | extent_size | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | files | initial_size | Int64 | FIELD | | No | Int64 | | @@ -152,49 +154,49 @@ select * from information_schema.columns order by table_schema, table_name; | greptime | information_schema | files | max_data_length | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | files | index_length | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | files | data_free | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | key_column_usage | constraint_schema | String | FIELD | | No | String | | -| greptime | information_schema | key_column_usage | constraint_name | String | FIELD | | No | String | | +| greptime | information_schema | global_status | variable_name | String | FIELD | | No | String | | +| greptime | information_schema | global_status | variable_value | String | FIELD | | No | String | | +| greptime | information_schema | key_column_usage | table_catalog | String | FIELD | | No | String | | +| greptime | information_schema | key_column_usage | ordinal_position | UInt32 | FIELD | | No | UInt32 | | | greptime | information_schema | key_column_usage | referenced_column_name | String | FIELD | | Yes | String | | | greptime | information_schema | key_column_usage | referenced_table_name | String | FIELD | | Yes | String | | | greptime | information_schema | key_column_usage | referenced_table_schema | String | FIELD | | Yes | String | | | greptime | information_schema | key_column_usage | position_in_unique_constraint | UInt32 | FIELD | | Yes | UInt32 | | -| greptime | information_schema | key_column_usage | ordinal_position | UInt32 | FIELD | | No | UInt32 | | -| greptime | information_schema | key_column_usage | column_name | String | FIELD | | No | String | | -| greptime | information_schema | key_column_usage | table_name | String | FIELD | | No | String | | -| greptime | information_schema | key_column_usage | table_schema | String | FIELD | | No | String | | -| greptime | information_schema | key_column_usage | table_catalog | String | FIELD | | No | String | | | greptime | information_schema | key_column_usage | constraint_catalog | String | FIELD | | No | String | | -| greptime | information_schema | optimizer_trace | missing_bytes_beyond_max_mem_size | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | optimizer_trace | query | String | FIELD | | No | String | | +| greptime | information_schema | key_column_usage | constraint_schema | String | FIELD | | No | String | | +| greptime | information_schema | key_column_usage | constraint_name | String | FIELD | | No | String | | +| greptime | information_schema | key_column_usage | table_schema | String | FIELD | | No | String | | +| greptime | information_schema | key_column_usage | table_name | String | FIELD | | No | String | | +| greptime | information_schema | key_column_usage | column_name | String | FIELD | | No | String | | | greptime | information_schema | optimizer_trace | insufficient_privileges | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | optimizer_trace | missing_bytes_beyond_max_mem_size | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | optimizer_trace | trace | String | FIELD | | No | String | | -| greptime | information_schema | parameters | collation_name | String | FIELD | | No | String | | -| greptime | information_schema | parameters | dtd_identifier | String | FIELD | | No | String | | +| greptime | information_schema | optimizer_trace | query | String | FIELD | | No | String | | +| greptime | information_schema | parameters | specific_catalog | String | FIELD | | No | String | | +| greptime | information_schema | parameters | character_maximum_length | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | parameters | routine_type | String | FIELD | | No | String | | -| greptime | information_schema | parameters | parameter_name | String | FIELD | | No | String | | +| greptime | information_schema | parameters | dtd_identifier | String | FIELD | | No | String | | +| greptime | information_schema | parameters | collation_name | String | FIELD | | No | String | | | greptime | information_schema | parameters | character_set_name | String | FIELD | | No | String | | | greptime | information_schema | parameters | datetime_precision | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | parameters | numeric_scale | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | parameters | numeric_precision | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | parameters | character_octet_length | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | parameters | data_type | String | FIELD | | No | String | | -| greptime | information_schema | parameters | character_maximum_length | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | parameters | specific_catalog | String | FIELD | | No | String | | | greptime | information_schema | parameters | specific_schema | String | FIELD | | No | String | | | greptime | information_schema | parameters | specific_name | String | FIELD | | No | String | | | greptime | information_schema | parameters | ordinal_position | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | parameters | parameter_mode | String | FIELD | | No | String | | -| greptime | information_schema | profiling | messages_received | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | profiling | context_involuntary | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | parameters | parameter_name | String | FIELD | | No | String | | +| greptime | information_schema | parameters | data_type | String | FIELD | | No | String | | | greptime | information_schema | profiling | block_ops_out | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | profiling | messages_sent | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | profiling | source_line | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | profiling | source_file | String | FIELD | | No | String | | | greptime | information_schema | profiling | source_function | String | FIELD | | No | String | | | greptime | information_schema | profiling | swaps | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | profiling | block_ops_in | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | profiling | page_faults_minor | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | profiling | page_faults_major | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | profiling | messages_received | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | profiling | query_id | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | profiling | seq | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | profiling | state | String | FIELD | | No | String | | @@ -202,34 +204,34 @@ select * from information_schema.columns order by table_schema, table_name; | greptime | information_schema | profiling | cpu_user | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | profiling | cpu_system | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | profiling | context_voluntary | Int64 | FIELD | | No | Int64 | | -| greptime | information_schema | referential_constraints | delete_rule | String | FIELD | | No | String | | -| greptime | information_schema | referential_constraints | constraint_catalog | String | FIELD | | No | String | | +| greptime | information_schema | profiling | context_involuntary | Int64 | FIELD | | No | Int64 | | +| greptime | information_schema | profiling | block_ops_in | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | referential_constraints | referenced_table_name | String | FIELD | | No | String | | +| greptime | information_schema | referential_constraints | constraint_name | String | FIELD | | No | String | | | greptime | information_schema | referential_constraints | table_name | String | FIELD | | No | String | | +| greptime | information_schema | referential_constraints | delete_rule | String | FIELD | | No | String | | | greptime | information_schema | referential_constraints | update_rule | String | FIELD | | No | String | | | greptime | information_schema | referential_constraints | match_option | String | FIELD | | No | String | | | greptime | information_schema | referential_constraints | unique_constraint_name | String | FIELD | | No | String | | | greptime | information_schema | referential_constraints | unique_constraint_schema | String | FIELD | | No | String | | | greptime | information_schema | referential_constraints | unique_constraint_catalog | String | FIELD | | No | String | | -| greptime | information_schema | referential_constraints | constraint_name | String | FIELD | | No | String | | +| greptime | information_schema | referential_constraints | constraint_catalog | String | FIELD | | No | String | | | greptime | information_schema | referential_constraints | constraint_schema | String | FIELD | | No | String | | -| greptime | information_schema | routines | sql_path | String | FIELD | | No | String | | -| greptime | information_schema | routines | routine_comment | String | FIELD | | No | String | | +| greptime | information_schema | routines | sql_mode | String | FIELD | | No | String | | +| greptime | information_schema | routines | security_type | String | FIELD | | No | String | | | greptime | information_schema | routines | database_collation | String | FIELD | | No | String | | -| greptime | information_schema | routines | collation_connection | String | FIELD | | No | String | | +| greptime | information_schema | routines | data_type | String | FIELD | | No | String | | | greptime | information_schema | routines | character_set_client | String | FIELD | | No | String | | | greptime | information_schema | routines | definer | String | FIELD | | No | String | | -| greptime | information_schema | routines | sql_mode | String | FIELD | | No | String | | +| greptime | information_schema | routines | routine_comment | String | FIELD | | No | String | | | greptime | information_schema | routines | last_altered | DateTime | FIELD | | No | DateTime | | | greptime | information_schema | routines | created | DateTime | FIELD | | No | DateTime | | -| greptime | information_schema | routines | security_type | String | FIELD | | No | String | | -| greptime | information_schema | routines | sql_data_access | String | FIELD | | No | String | | | greptime | information_schema | routines | specific_name | String | FIELD | | No | String | | | greptime | information_schema | routines | routine_catalog | String | FIELD | | No | String | | | greptime | information_schema | routines | routine_schema | String | FIELD | | No | String | | | greptime | information_schema | routines | routine_name | String | FIELD | | No | String | | | greptime | information_schema | routines | routine_type | String | FIELD | | No | String | | -| greptime | information_schema | routines | data_type | String | FIELD | | No | String | | +| greptime | information_schema | routines | collation_connection | String | FIELD | | No | String | | | greptime | information_schema | routines | character_maximum_length | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | routines | character_octet_length | Int64 | FIELD | | No | Int64 | | | greptime | information_schema | routines | numeric_precision | Int64 | FIELD | | No | Int64 | | @@ -244,8 +246,10 @@ select * from information_schema.columns order by table_schema, table_name; | greptime | information_schema | routines | external_language | String | FIELD | | No | String | | | greptime | information_schema | routines | parameter_style | String | FIELD | | No | String | | | greptime | information_schema | routines | is_deterministic | String | FIELD | | No | String | | -| greptime | information_schema | schema_privileges | grantee | String | FIELD | | No | String | | +| greptime | information_schema | routines | sql_data_access | String | FIELD | | No | String | | +| greptime | information_schema | routines | sql_path | String | FIELD | | No | String | | | greptime | information_schema | schema_privileges | is_grantable | String | FIELD | | No | String | | +| greptime | information_schema | schema_privileges | grantee | String | FIELD | | No | String | | | greptime | information_schema | schema_privileges | privilege_type | String | FIELD | | No | String | | | greptime | information_schema | schema_privileges | table_schema | String | FIELD | | No | String | | | greptime | information_schema | schema_privileges | table_catalog | String | FIELD | | No | String | | @@ -254,23 +258,21 @@ select * from information_schema.columns order by table_schema, table_name; | greptime | information_schema | schemata | sql_path | String | FIELD | | Yes | String | | | greptime | information_schema | schemata | default_character_set_name | String | FIELD | | No | String | | | greptime | information_schema | schemata | default_collation_name | String | FIELD | | No | String | | +| greptime | information_schema | session_status | variable_value | String | FIELD | | No | String | | +| greptime | information_schema | session_status | variable_name | String | FIELD | | No | String | | | greptime | information_schema | table_privileges | grantee | String | FIELD | | No | String | | | greptime | information_schema | table_privileges | table_catalog | String | FIELD | | No | String | | | greptime | information_schema | table_privileges | table_schema | String | FIELD | | No | String | | | greptime | information_schema | table_privileges | table_name | String | FIELD | | No | String | | | greptime | information_schema | table_privileges | privilege_type | String | FIELD | | No | String | | | greptime | information_schema | table_privileges | is_grantable | String | FIELD | | No | String | | -| greptime | information_schema | tables | table_schema | String | FIELD | | No | String | | +| greptime | information_schema | tables | table_catalog | String | FIELD | | No | String | | | greptime | information_schema | tables | table_name | String | FIELD | | No | String | | | greptime | information_schema | tables | table_type | String | FIELD | | No | String | | -| greptime | information_schema | tables | table_id | UInt32 | FIELD | | Yes | UInt32 | | | greptime | information_schema | tables | engine | String | FIELD | | Yes | String | | -| greptime | information_schema | tables | table_catalog | String | FIELD | | No | String | | -| greptime | information_schema | triggers | trigger_catalog | String | FIELD | | No | String | | -| greptime | information_schema | triggers | trigger_schema | String | FIELD | | No | String | | -| greptime | information_schema | triggers | trigger_name | String | FIELD | | No | String | | +| greptime | information_schema | tables | table_schema | String | FIELD | | No | String | | +| greptime | information_schema | tables | table_id | UInt32 | FIELD | | Yes | UInt32 | | | greptime | information_schema | triggers | event_manipulation | String | FIELD | | No | String | | -| greptime | information_schema | triggers | event_object_catalog | String | FIELD | | No | String | | | greptime | information_schema | triggers | event_object_schema | String | FIELD | | No | String | | | greptime | information_schema | triggers | event_object_table | String | FIELD | | No | String | | | greptime | information_schema | triggers | action_order | Int64 | FIELD | | No | Int64 | | @@ -288,6 +290,10 @@ select * from information_schema.columns order by table_schema, table_name; | greptime | information_schema | triggers | character_set_client | String | FIELD | | No | String | | | greptime | information_schema | triggers | collation_connection | String | FIELD | | No | String | | | greptime | information_schema | triggers | database_collation | String | FIELD | | No | String | | +| greptime | information_schema | triggers | trigger_catalog | String | FIELD | | No | String | | +| greptime | information_schema | triggers | event_object_catalog | String | FIELD | | No | String | | +| greptime | information_schema | triggers | trigger_name | String | FIELD | | No | String | | +| greptime | information_schema | triggers | trigger_schema | String | FIELD | | No | String | | | greptime | public | numbers | number | UInt32 | TAG | | No | UInt32 | | +---------------+--------------------+---------------------------------------+-----------------------------------+-----------+---------------+----------------+-------------+-------------+----------------+ From 00707d3e46e9095a7f9f7ffc7246fd5ed2f3a932 Mon Sep 17 00:00:00 2001 From: test Date: Mon, 1 Jan 2024 16:00:27 +0800 Subject: [PATCH 13/14] fix: add TODO for some tables --- src/catalog/src/information_schema/memory_table/tables.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/catalog/src/information_schema/memory_table/tables.rs b/src/catalog/src/information_schema/memory_table/tables.rs index 7598bca7a23a..ef38af96c659 100644 --- a/src/catalog/src/information_schema/memory_table/tables.rs +++ b/src/catalog/src/information_schema/memory_table/tables.rs @@ -227,6 +227,7 @@ pub fn get_schema_columns(table_name: &str) -> (SchemaRef, Vec) { vec![], ), + // TODO: GreptimeDB already has query tracing, support later. cc @Taylor-lagrange OPTIMIZER_TRACE => ( vec![ string_column("QUERY"), @@ -287,6 +288,7 @@ pub fn get_schema_columns(table_name: &str) -> (SchemaRef, Vec) { vec![], ), + // TODO: _Must_ reimplement this table when foreign key constraint is supported. REFERENTIAL_CONSTRAINTS => ( vec![ string_column("CONSTRAINT_CATALOG"), @@ -392,6 +394,8 @@ pub fn get_schema_columns(table_name: &str) -> (SchemaRef, Vec) { vec![], ), + // TODO: Considering store internal metrics in `global_status` and + // `session_status` tables. GLOBAL_STATUS => ( vec![ string_column("VARIABLE_NAME"), From 7d1ebe1fe78294c8c75634629c5aeb39d1c417da Mon Sep 17 00:00:00 2001 From: dennis zhuang Date: Tue, 2 Jan 2024 11:56:25 +0800 Subject: [PATCH 14/14] Update src/catalog/src/information_schema/memory_table/tables.rs Co-authored-by: Yingwen --- src/catalog/src/information_schema/memory_table/tables.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/catalog/src/information_schema/memory_table/tables.rs b/src/catalog/src/information_schema/memory_table/tables.rs index ef38af96c659..9922edd7c49f 100644 --- a/src/catalog/src/information_schema/memory_table/tables.rs +++ b/src/catalog/src/information_schema/memory_table/tables.rs @@ -227,7 +227,6 @@ pub fn get_schema_columns(table_name: &str) -> (SchemaRef, Vec) { vec![], ), - // TODO: GreptimeDB already has query tracing, support later. cc @Taylor-lagrange OPTIMIZER_TRACE => ( vec![ string_column("QUERY"),