diff --git a/src/query/service/tests/it/servers/http/http_query_handlers.rs b/src/query/service/tests/it/servers/http/http_query_handlers.rs index d95af493e7c2..6fa2fd8f5e5d 100644 --- a/src/query/service/tests/it/servers/http/http_query_handlers.rs +++ b/src/query/service/tests/it/servers/http/http_query_handlers.rs @@ -285,7 +285,7 @@ async fn test_simple_sql() -> Result<()> { assert_eq!(result.state, ExecuteStateKind::Succeeded, "{:?}", result); assert_eq!(result.next_uri, Some(final_uri.clone()), "{:?}", result); assert_eq!(result.data.len(), 10, "{:?}", result); - assert_eq!(result.schema.len(), 21, "{:?}", result); + assert_eq!(result.schema.len(), 22, "{:?}", result); // get state let uri = result.stats_uri.unwrap(); diff --git a/src/query/service/tests/it/storages/testdata/columns_table.txt b/src/query/service/tests/it/storages/testdata/columns_table.txt index 433b47e5d2e7..87456d25dc2d 100644 --- a/src/query/service/tests/it/storages/testdata/columns_table.txt +++ b/src/query/service/tests/it/storages/testdata/columns_table.txt @@ -447,6 +447,8 @@ DB.Table: 'system'.'columns', Table: columns-table_id:1, ver:0, Engine: SystemCo | 'task_type' | 'system' | 'background_jobs' | 'String' | 'VARCHAR' | '' | '' | 'NO' | '' | | 'tenant_id' | 'system' | 'query_log' | 'String' | 'VARCHAR' | '' | '' | 'NO' | '' | | 'time' | 'system' | 'processes' | 'UInt64' | 'BIGINT UNSIGNED' | '' | '' | 'NO' | '' | +| 'total_columns' | 'system' | 'tables' | 'UInt64' | 'BIGINT UNSIGNED' | '' | '' | 'NO' | '' | +| 'total_columns' | 'system' | 'tables_with_history' | 'UInt64' | 'BIGINT UNSIGNED' | '' | '' | 'NO' | '' | | 'total_partitions' | 'system' | 'query_log' | 'UInt64' | 'BIGINT UNSIGNED' | '' | '' | 'NO' | '' | | 'trigger' | 'system' | 'background_tasks' | 'Nullable(String)' | 'VARCHAR' | '' | '' | 'YES' | '' | | 'type' | 'system' | 'background_tasks' | 'String' | 'VARCHAR' | '' | '' | 'NO' | '' | diff --git a/src/query/storages/system/src/tables_table.rs b/src/query/storages/system/src/tables_table.rs index 0fd595579d54..0817f756e5f1 100644 --- a/src/query/storages/system/src/tables_table.rs +++ b/src/query/storages/system/src/tables_table.rs @@ -146,6 +146,10 @@ where TablesTable: HistoryAware TableField::new("database", TableDataType::String), TableField::new("name", TableDataType::String), TableField::new("table_id", TableDataType::Number(NumberDataType::UInt64)), + TableField::new( + "total_columns", + TableDataType::Number(NumberDataType::UInt64), + ), TableField::new("engine", TableDataType::String), TableField::new("engine_full", TableDataType::String), TableField::new("cluster_by", TableDataType::String), @@ -587,6 +591,10 @@ where TablesTable: HistoryAware .iter() .map(|v| v.get_table_info().ident.table_id) .collect(); + let total_columns: Vec = database_tables + .iter() + .map(|v| v.get_table_info().schema().fields().len() as u64) + .collect(); let engines: Vec = database_tables .iter() .map(|v| v.engine().to_string()) @@ -678,6 +686,7 @@ where TablesTable: HistoryAware StringType::from_data(databases), StringType::from_data(names), UInt64Type::from_data(table_id), + UInt64Type::from_data(total_columns), StringType::from_data(engines), StringType::from_data(engines_full), StringType::from_data(cluster_bys), diff --git a/tests/suites/0_stateless/18_rbac/18_0007_privilege_access.result b/tests/suites/0_stateless/18_rbac/18_0007_privilege_access.result index 2b06a7d35a1f..9b12c0afb052 100644 --- a/tests/suites/0_stateless/18_rbac/18_0007_privilege_access.result +++ b/tests/suites/0_stateless/18_rbac/18_0007_privilege_access.result @@ -80,6 +80,7 @@ number_of_segments BIGINT UNSIGNED YES NULL NULL owner VARCHAR YES NULL NULL table_id BIGINT UNSIGNED NO NULL NULL table_type VARCHAR NO NULL NULL +total_columns BIGINT UNSIGNED NO NULL NULL updated_on TIMESTAMP NO NULL NULL Error: APIError: ResponseError with 1063: Permission denied: User 'a'@'%' does not have the required privileges for database 'nogrant' 1