From 4d1308d64195b996b2e1074691ae3f5e38fceb5e Mon Sep 17 00:00:00 2001 From: 2149 <260391947@qq.com> Date: Mon, 20 Nov 2023 09:27:58 +0000 Subject: [PATCH] [CP] Fix show table status bug --- .../virtual_table/ob_tenant_all_tables.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/observer/virtual_table/ob_tenant_all_tables.cpp b/src/observer/virtual_table/ob_tenant_all_tables.cpp index 19b085196d..6e18ba5a3e 100644 --- a/src/observer/virtual_table/ob_tenant_all_tables.cpp +++ b/src/observer/virtual_table/ob_tenant_all_tables.cpp @@ -36,8 +36,8 @@ namespace observer #define TABLE_STATUS_SQL "select /*+ leading(a) no_use_nl(ts)*/" \ "cast( coalesce(ts.row_cnt,0) as unsigned) as table_rows," \ "cast( coalesce(ts.data_size,0) as unsigned) as data_length," \ - "cast(a.gmt_create as datetime) as create_time," \ - "cast(a.gmt_modified as datetime) as update_time " \ + "a.gmt_create as create_time," \ + "a.gmt_modified as update_time " \ "from " \ "(" \ "select tenant_id," \ @@ -262,10 +262,19 @@ int ObTenantAllTables::get_table_stats() LOG_WARN("get next row failed", K(ret)); } } else { + int64_t default_time = 0; + int64_t time = 0; + common::ObTimeZoneInfoWrap tz_info_wrap; + GET_TIMESTAMP_COL_BY_NAME_IGNORE_NULL_WITH_DEFAULT_VALUE( + result->get_timestamp, "create_time", time, + default_time, tz_info_wrap.get_time_zone_info()); + tab_stat.set_create_time(time); + GET_TIMESTAMP_COL_BY_NAME_IGNORE_NULL_WITH_DEFAULT_VALUE( + result->get_timestamp, "update_time", time, + default_time, tz_info_wrap.get_time_zone_info()); + tab_stat.set_update_time(time); EXTRACT_UINT_FIELD_TO_CLASS_MYSQL(*result, table_rows, tab_stat, int64_t); EXTRACT_UINT_FIELD_TO_CLASS_MYSQL(*result, data_length, tab_stat, int64_t); - EXTRACT_LAST_DDL_TIME_FIELD_TO_INT_MYSQL(*result, create_time, tab_stat, int64_t); - EXTRACT_LAST_DDL_TIME_FIELD_TO_INT_MYSQL(*result, update_time, tab_stat, int64_t); } } }