From d798c34580d7d555e976ce4068e6424cdd207e1b Mon Sep 17 00:00:00 2001 From: tino247 Date: Thu, 4 Jan 2024 13:19:16 +0000 Subject: [PATCH] [UPGRADE] Modify sys view definition when lower_case_table_names = 0 --- .../ob_inner_table_schema.21251_21300.cpp | 12 +++---- .../inner_table/ob_inner_table_schema_def.py | 32 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/share/inner_table/ob_inner_table_schema.21251_21300.cpp b/src/share/inner_table/ob_inner_table_schema.21251_21300.cpp index b0d9945649..bcfd7418a2 100644 --- a/src/share/inner_table/ob_inner_table_schema.21251_21300.cpp +++ b/src/share/inner_table/ob_inner_table_schema.21251_21300.cpp @@ -160,7 +160,7 @@ int ObInnerTableSchema::dba_tab_col_statistics_schema(ObTableSchema &table_schem table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); if (OB_SUCC(ret)) { - if (OB_FAIL(table_schema.set_view_definition(R"__(SELECT cast(db.database_name as CHAR(128)) as OWNER, cast(t.table_name as CHAR(128)) as TABLE_NAME, cast(c.column_name as CHAR(128)) as COLUMN_NAME, cast(stat.distinct_cnt as NUMBER) as NUM_DISTINCT, cast(stat.min_value as CHAR(128)) as LOW_VALUE, cast(stat.max_value as CHAR(128)) as HIGH_VALUE, cast(stat.density as NUMBER) as DENSITY, cast(stat.null_cnt as NUMBER) as NUM_NULLS, cast(stat.bucket_cnt as NUMBER) as NUM_BUCKETS, cast(stat.last_analyzed as DATETIME(6)) as LAST_ANALYZED, cast(stat.sample_size as NUMBER) as SAMPLE_SIZE, CAST((CASE STAT.GLOBAL_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS GLOBAL_STATS, CAST((CASE STAT.USER_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS USER_STATS, cast(NULL as CHAR(80)) as NOTES, cast(stat.avg_len as NUMBER) as AVG_COL_LEN, cast((case when stat.histogram_type = 1 then 'FREQUENCY' when stat.histogram_type = 3 then 'TOP-FREQUENCY' when stat.histogram_type = 4 then 'HYBRID' else NULL end) as CHAR(15)) as HISTOGRAM, cast(NULL as CHAR(7)) SCOPE FROM (SELECT CAST(0 AS SIGNED) AS TENANT_ID, DATABASE_ID, TABLE_ID, TABLE_NAME FROM OCEANBASE.__ALL_VIRTUAL_CORE_ALL_TABLE WHERE TENANT_ID = EFFECTIVE_TENANT_ID() UNION ALL SELECT TENANT_ID, database_id, table_id, table_name FROM oceanbase.__all_table where table_type in (0,2,3,6,14) and table_mode >> 12 & 15 in (0,1)) T JOIN oceanbase.__all_database db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id AND T.TENANT_ID = 0 JOIN (SELECT CAST(0 AS SIGNED) AS TENANT_ID, TABLE_ID, COLUMN_ID, COLUMN_NAME, IS_HIDDEN FROM oceanbase.__all_virtual_core_column_table WHERE TENANT_ID = EFFECTIVE_TENANT_ID() UNION ALL SELECT TENANT_ID, TABLE_ID, COLUMN_ID, COLUMN_NAME, IS_HIDDEN FROM oceanbase.__all_column) c ON c.tenant_id = t.tenant_id AND c.table_id = t.table_id left join oceanbase.__all_column_stat stat ON c.table_id = stat.table_id AND c.column_id = stat.column_id AND stat.object_type = 1 WHERE c.is_hidden = 0 )__"))) { + if (OB_FAIL(table_schema.set_view_definition(R"__(SELECT cast(db.database_name as CHAR(128)) as OWNER, cast(t.table_name as CHAR(128)) as TABLE_NAME, cast(c.column_name as CHAR(128)) as COLUMN_NAME, cast(stat.distinct_cnt as NUMBER) as NUM_DISTINCT, cast(stat.min_value as CHAR(128)) as LOW_VALUE, cast(stat.max_value as CHAR(128)) as HIGH_VALUE, cast(stat.density as NUMBER) as DENSITY, cast(stat.null_cnt as NUMBER) as NUM_NULLS, cast(stat.bucket_cnt as NUMBER) as NUM_BUCKETS, cast(stat.last_analyzed as DATETIME(6)) as LAST_ANALYZED, cast(stat.sample_size as NUMBER) as SAMPLE_SIZE, CAST((CASE stat.GLOBAL_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS GLOBAL_STATS, CAST((CASE stat.USER_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS USER_STATS, cast(NULL as CHAR(80)) as NOTES, cast(stat.avg_len as NUMBER) as AVG_COL_LEN, cast((case when stat.histogram_type = 1 then 'FREQUENCY' when stat.histogram_type = 3 then 'TOP-FREQUENCY' when stat.histogram_type = 4 then 'HYBRID' else NULL end) as CHAR(15)) as HISTOGRAM, cast(NULL as CHAR(7)) SCOPE FROM (SELECT CAST(0 AS SIGNED) AS TENANT_ID, DATABASE_ID, TABLE_ID, TABLE_NAME FROM oceanbase.__all_virtual_core_all_table WHERE TENANT_ID = EFFECTIVE_TENANT_ID() UNION ALL SELECT TENANT_ID, database_id, table_id, table_name FROM oceanbase.__all_table where table_type in (0,2,3,6,14) and table_mode >> 12 & 15 in (0,1)) t JOIN oceanbase.__all_database db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id and t.tenant_id = 0 JOIN (SELECT CAST(0 AS SIGNED) AS TENANT_ID, TABLE_ID, COLUMN_ID, COLUMN_NAME, IS_HIDDEN FROM oceanbase.__all_virtual_core_column_table WHERE TENANT_ID = EFFECTIVE_TENANT_ID() UNION ALL SELECT TENANT_ID, TABLE_ID, COLUMN_ID, COLUMN_NAME, IS_HIDDEN FROM oceanbase.__all_column) c ON c.tenant_id = t.tenant_id AND c.table_id = t.table_id left join oceanbase.__all_column_stat stat ON c.table_id = stat.table_id AND c.column_id = stat.column_id AND stat.object_type = 1 WHERE c.is_hidden = 0 )__"))) { LOG_ERROR("fail to set view_definition", K(ret)); } } @@ -210,7 +210,7 @@ int ObInnerTableSchema::dba_part_col_statistics_schema(ObTableSchema &table_sche table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); if (OB_SUCC(ret)) { - if (OB_FAIL(table_schema.set_view_definition(R"__(SELECT cast(db.database_name as CHAR(128)) as OWNER, cast(t.table_name as CHAR(128)) as TABLE_NAME, cast (part.part_name as CHAR(128)) as PARTITION_NAME, cast(c.column_name as CHAR(128)) as COLUMN_NAME, cast(stat.distinct_cnt as NUMBER) as NUM_DISTINCT, cast(stat.min_value as CHAR(128)) as LOW_VALUE, cast(stat.max_value as CHAR(128)) as HIGH_VALUE, cast(stat.density as NUMBER) as DENSITY, cast(stat.null_cnt as NUMBER) as NUM_NULLS, cast(stat.bucket_cnt as NUMBER) as NUM_BUCKETS, cast(stat.last_analyzed as DATETIME(6)) as LAST_ANALYZED, cast(stat.sample_size as NUMBER) as SAMPLE_SIZE, CAST((CASE STAT.GLOBAL_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS GLOBAL_STATS, CAST((CASE STAT.USER_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS USER_STATS, cast(NULL as CHAR(80)) as NOTES, cast(stat.avg_len as NUMBER) as AVG_COL_LEN, cast((case when stat.histogram_type = 1 then 'FREQUENCY' when stat.histogram_type = 3 then 'TOP-FREQUENCY' when stat.histogram_type = 4 then 'HYBRID' else NULL end) as CHAR(15)) as HISTOGRAM FROM oceanbase.__all_table t JOIN oceanbase.__all_database db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id AND T.TENANT_ID = 0 JOIN oceanbase.__all_column c ON c.tenant_id = t.tenant_id AND c.table_id = t.table_id JOIN oceanbase.__all_part part on t.tenant_id = part.tenant_id and t.table_id = part.table_id left join oceanbase.__all_column_stat stat ON c.table_id = stat.table_id AND c.column_id = stat.column_id AND part.part_id = stat.partition_id AND stat.object_type = 2 WHERE c.is_hidden = 0 AND t.table_type in (0,3,6,14) AND t.table_mode >> 12 & 15 in (0,1) )__"))) { + if (OB_FAIL(table_schema.set_view_definition(R"__(SELECT cast(db.database_name as CHAR(128)) as OWNER, cast(t.table_name as CHAR(128)) as TABLE_NAME, cast (part.part_name as CHAR(128)) as PARTITION_NAME, cast(c.column_name as CHAR(128)) as COLUMN_NAME, cast(stat.distinct_cnt as NUMBER) as NUM_DISTINCT, cast(stat.min_value as CHAR(128)) as LOW_VALUE, cast(stat.max_value as CHAR(128)) as HIGH_VALUE, cast(stat.density as NUMBER) as DENSITY, cast(stat.null_cnt as NUMBER) as NUM_NULLS, cast(stat.bucket_cnt as NUMBER) as NUM_BUCKETS, cast(stat.last_analyzed as DATETIME(6)) as LAST_ANALYZED, cast(stat.sample_size as NUMBER) as SAMPLE_SIZE, CAST((CASE stat.GLOBAL_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS GLOBAL_STATS, CAST((CASE stat.USER_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS USER_STATS, cast(NULL as CHAR(80)) as NOTES, cast(stat.avg_len as NUMBER) as AVG_COL_LEN, cast((case when stat.histogram_type = 1 then 'FREQUENCY' when stat.histogram_type = 3 then 'TOP-FREQUENCY' when stat.histogram_type = 4 then 'HYBRID' else NULL end) as CHAR(15)) as HISTOGRAM FROM oceanbase.__all_table t JOIN oceanbase.__all_database db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id and t.tenant_id = 0 JOIN oceanbase.__all_column c ON c.tenant_id = t.tenant_id AND c.table_id = t.table_id JOIN oceanbase.__all_part part on t.tenant_id = part.tenant_id and t.table_id = part.table_id left join oceanbase.__all_column_stat stat ON c.table_id = stat.table_id AND c.column_id = stat.column_id AND part.part_id = stat.partition_id AND stat.object_type = 2 WHERE c.is_hidden = 0 AND t.table_type in (0,3,6,14) AND t.table_mode >> 12 & 15 in (0,1) )__"))) { LOG_ERROR("fail to set view_definition", K(ret)); } } @@ -260,7 +260,7 @@ int ObInnerTableSchema::dba_subpart_col_statistics_schema(ObTableSchema &table_s table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); if (OB_SUCC(ret)) { - if (OB_FAIL(table_schema.set_view_definition(R"__(SELECT cast(db.database_name as CHAR(128)) as OWNER, cast(t.table_name as CHAR(128)) as TABLE_NAME, cast (subpart.sub_part_name as CHAR(128)) as SUBPARTITION_NAME, cast(c.column_name as CHAR(128)) as COLUMN_NAME, cast(stat.distinct_cnt as NUMBER) as NUM_DISTINCT, cast(stat.min_value as CHAR(128)) as LOW_VALUE, cast(stat.max_value as CHAR(128)) as HIGH_VALUE, cast(stat.density as NUMBER) as DENSITY, cast(stat.null_cnt as NUMBER) as NUM_NULLS, cast(stat.bucket_cnt as NUMBER) as NUM_BUCKETS, cast(stat.last_analyzed as DATETIME(6)) as LAST_ANALYZED, cast(stat.sample_size as NUMBER) as SAMPLE_SIZE, CAST((CASE STAT.GLOBAL_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS GLOBAL_STATS, CAST((CASE STAT.USER_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS USER_STATS, cast(NULL as CHAR(80)) as NOTES, cast(stat.avg_len as NUMBER) as AVG_COL_LEN, cast((case when stat.histogram_type = 1 then 'FREQUENCY' when stat.histogram_type = 3 then 'TOP-FREQUENCY' when stat.histogram_type = 4 then 'HYBRID' else NULL end) as CHAR(15)) as HISTOGRAM FROM oceanbase.__all_table t JOIN oceanbase.__all_database db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id AND T.TENANT_ID = 0 JOIN oceanbase.__all_column c ON c.tenant_id = t.tenant_id AND c.table_id = t.table_id JOIN oceanbase.__all_sub_part subpart on t.tenant_id = subpart.tenant_id and t.table_id = subpart.table_id left join oceanbase.__all_column_stat stat ON c.table_id = stat.table_id AND c.column_id = stat.column_id AND stat.partition_id = subpart.sub_part_id AND stat.object_type = 3 WHERE c.is_hidden = 0 AND t.table_type in (0,3,6,14) AND t.table_mode >> 12 & 15 in (0,1) )__"))) { + if (OB_FAIL(table_schema.set_view_definition(R"__(SELECT cast(db.database_name as CHAR(128)) as OWNER, cast(t.table_name as CHAR(128)) as TABLE_NAME, cast (subpart.sub_part_name as CHAR(128)) as SUBPARTITION_NAME, cast(c.column_name as CHAR(128)) as COLUMN_NAME, cast(stat.distinct_cnt as NUMBER) as NUM_DISTINCT, cast(stat.min_value as CHAR(128)) as LOW_VALUE, cast(stat.max_value as CHAR(128)) as HIGH_VALUE, cast(stat.density as NUMBER) as DENSITY, cast(stat.null_cnt as NUMBER) as NUM_NULLS, cast(stat.bucket_cnt as NUMBER) as NUM_BUCKETS, cast(stat.last_analyzed as DATETIME(6)) as LAST_ANALYZED, cast(stat.sample_size as NUMBER) as SAMPLE_SIZE, CAST((CASE stat.GLOBAL_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS GLOBAL_STATS, CAST((CASE stat.USER_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS USER_STATS, cast(NULL as CHAR(80)) as NOTES, cast(stat.avg_len as NUMBER) as AVG_COL_LEN, cast((case when stat.histogram_type = 1 then 'FREQUENCY' when stat.histogram_type = 3 then 'TOP-FREQUENCY' when stat.histogram_type = 4 then 'HYBRID' else NULL end) as CHAR(15)) as HISTOGRAM FROM oceanbase.__all_table t JOIN oceanbase.__all_database db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id and t.tenant_id = 0 JOIN oceanbase.__all_column c ON c.tenant_id = t.tenant_id AND c.table_id = t.table_id JOIN oceanbase.__all_sub_part subpart on t.tenant_id = subpart.tenant_id and t.table_id = subpart.table_id left join oceanbase.__all_column_stat stat ON c.table_id = stat.table_id AND c.column_id = stat.column_id AND stat.partition_id = subpart.sub_part_id AND stat.object_type = 3 WHERE c.is_hidden = 0 AND t.table_type in (0,3,6,14) AND t.table_mode >> 12 & 15 in (0,1) )__"))) { LOG_ERROR("fail to set view_definition", K(ret)); } } @@ -310,7 +310,7 @@ int ObInnerTableSchema::dba_tab_histograms_schema(ObTableSchema &table_schema) table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); if (OB_SUCC(ret)) { - if (OB_FAIL(table_schema.set_view_definition(R"__(select cast(db.database_name as CHAR(128)) as OWNER, cast(t.table_name as CHAR(128)) as TABLE_NAME, cast(c.column_name as CHAR(128)) as COLUMN_NAME, cast(hist.endpoint_num as NUMBER) as ENDPOINT_NUMBER, cast(NULL as NUMBER) as ENDPOINT_VALUE, cast(hist.endpoint_value as CHAR(4000)) as ENDPOINT_ACTUAL_VALUE, cast(hist.b_endpoint_value as CHAR(4000)) as ENDPOINT_ACTUAL_VALUE_RAW, cast(hist.endpoint_repeat_cnt as NUMBER) as ENDPOINT_REPEAT_COUNT, cast(NULL as CHAR(7)) as SCOPE FROM (SELECT CAST(0 AS SIGNED) AS TENANT_ID, DATABASE_ID, TABLE_ID, TABLE_NAME FROM OCEANBASE.__ALL_VIRTUAL_CORE_ALL_TABLE UNION ALL SELECT TENANT_ID, database_id, table_id, table_name FROM oceanbase.__all_table where table_type in (0,3,6,14) and table_mode >> 12 & 15 in (0,1)) T JOIN oceanbase.__all_database db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id AND T.TENANT_ID = 0 JOIN oceanbase.__all_column c ON c.tenant_id = t.tenant_id AND c.table_id = t.table_id JOIN oceanbase.__all_histogram_stat hist ON c.table_id = hist.table_id AND c.column_id = hist.column_id AND hist.object_type = 1 WHERE c.is_hidden = 0 )__"))) { + if (OB_FAIL(table_schema.set_view_definition(R"__(select cast(db.database_name as CHAR(128)) as OWNER, cast(t.table_name as CHAR(128)) as TABLE_NAME, cast(c.column_name as CHAR(128)) as COLUMN_NAME, cast(hist.endpoint_num as NUMBER) as ENDPOINT_NUMBER, cast(NULL as NUMBER) as ENDPOINT_VALUE, cast(hist.endpoint_value as CHAR(4000)) as ENDPOINT_ACTUAL_VALUE, cast(hist.b_endpoint_value as CHAR(4000)) as ENDPOINT_ACTUAL_VALUE_RAW, cast(hist.endpoint_repeat_cnt as NUMBER) as ENDPOINT_REPEAT_COUNT, cast(NULL as CHAR(7)) as SCOPE FROM (SELECT CAST(0 AS SIGNED) AS TENANT_ID, DATABASE_ID, TABLE_ID, TABLE_NAME FROM oceanbase.__all_virtual_core_all_table UNION ALL SELECT TENANT_ID, database_id, table_id, table_name FROM oceanbase.__all_table where table_type in (0,3,6,14) and table_mode >> 12 & 15 in (0,1)) t JOIN oceanbase.__all_database db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id and t.tenant_id = 0 JOIN oceanbase.__all_column c ON c.tenant_id = t.tenant_id AND c.table_id = t.table_id JOIN oceanbase.__all_histogram_stat hist ON c.table_id = hist.table_id AND c.column_id = hist.column_id AND hist.object_type = 1 WHERE c.is_hidden = 0 )__"))) { LOG_ERROR("fail to set view_definition", K(ret)); } } @@ -360,7 +360,7 @@ int ObInnerTableSchema::dba_part_histograms_schema(ObTableSchema &table_schema) table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); if (OB_SUCC(ret)) { - if (OB_FAIL(table_schema.set_view_definition(R"__(select cast(db.database_name as CHAR(128)) as OWNER, cast(t.table_name as CHAR(128)) as TABLE_NAME, cast(part.part_name as CHAR(128)) as PARTITION_NAME, cast(c.column_name as CHAR(128)) as COLUMN_NAME, cast(hist.endpoint_num as NUMBER) as ENDPOINT_NUMBER, cast(NULL as NUMBER) as ENDPOINT_VALUE, cast(hist.endpoint_value as CHAR(4000)) as ENDPOINT_ACTUAL_VALUE, cast(hist.b_endpoint_value as CHAR(4000)) as ENDPOINT_ACTUAL_VALUE_RAW, cast(hist.endpoint_repeat_cnt as NUMBER) as ENDPOINT_REPEAT_COUNT FROM oceanbase.__all_table t JOIN oceanbase.__all_database db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id AND T.TENANT_ID = 0 JOIN oceanbase.__all_column c ON c.tenant_id = t.tenant_id AND c.table_id = t.table_id JOIN oceanbase.__all_part part on t.tenant_id = part.tenant_id and t.table_id = part.table_id JOIN oceanbase.__all_histogram_stat hist ON c.table_id = hist.table_id AND c.column_id = hist.column_id AND part.part_id = hist.partition_id AND hist.object_type = 2 WHERE c.is_hidden = 0 AND t.table_type in (0,3,6,14) AND t.table_mode >> 12 & 15 in (0,1) )__"))) { + if (OB_FAIL(table_schema.set_view_definition(R"__(select cast(db.database_name as CHAR(128)) as OWNER, cast(t.table_name as CHAR(128)) as TABLE_NAME, cast(part.part_name as CHAR(128)) as PARTITION_NAME, cast(c.column_name as CHAR(128)) as COLUMN_NAME, cast(hist.endpoint_num as NUMBER) as ENDPOINT_NUMBER, cast(NULL as NUMBER) as ENDPOINT_VALUE, cast(hist.endpoint_value as CHAR(4000)) as ENDPOINT_ACTUAL_VALUE, cast(hist.b_endpoint_value as CHAR(4000)) as ENDPOINT_ACTUAL_VALUE_RAW, cast(hist.endpoint_repeat_cnt as NUMBER) as ENDPOINT_REPEAT_COUNT FROM oceanbase.__all_table t JOIN oceanbase.__all_database db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id and t.tenant_id = 0 JOIN oceanbase.__all_column c ON c.tenant_id = t.tenant_id AND c.table_id = t.table_id JOIN oceanbase.__all_part part on t.tenant_id = part.tenant_id and t.table_id = part.table_id JOIN oceanbase.__all_histogram_stat hist ON c.table_id = hist.table_id AND c.column_id = hist.column_id AND part.part_id = hist.partition_id AND hist.object_type = 2 WHERE c.is_hidden = 0 AND t.table_type in (0,3,6,14) AND t.table_mode >> 12 & 15 in (0,1) )__"))) { LOG_ERROR("fail to set view_definition", K(ret)); } } @@ -410,7 +410,7 @@ int ObInnerTableSchema::dba_subpart_histograms_schema(ObTableSchema &table_schem table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); if (OB_SUCC(ret)) { - if (OB_FAIL(table_schema.set_view_definition(R"__(select cast(db.database_name as CHAR(128)) as OWNER, cast(t.table_name as CHAR(128)) as TABLE_NAME, cast(subpart.sub_part_name as CHAR(128)) as SUBPARTITION_NAME, cast(c.column_name as CHAR(128)) as COLUMN_NAME, cast(hist.endpoint_num as NUMBER) as ENDPOINT_NUMBER, cast(NULL as NUMBER) as ENDPOINT_VALUE, cast(hist.endpoint_value as CHAR(4000)) as ENDPOINT_ACTUAL_VALUE, cast(hist.b_endpoint_value as CHAR(4000)) as ENDPOINT_ACTUAL_VALUE_RAW, cast(hist.endpoint_repeat_cnt as NUMBER) as ENDPOINT_REPEAT_COUNT FROM oceanbase.__all_table t JOIN oceanbase.__all_database db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id AND T.TENANT_ID = 0 JOIN oceanbase.__all_column c ON c.tenant_id = t.tenant_id AND c.table_id = t.table_id JOIN oceanbase.__all_sub_part subpart on t.tenant_id = subpart.tenant_id and t.table_id = subpart.table_id JOIN oceanbase.__all_histogram_stat hist ON c.table_id = hist.table_id AND c.column_id = hist.column_id AND hist.partition_id = subpart.sub_part_id AND hist.object_type = 3 WHERE c.is_hidden = 0 AND t.table_type in (0,3,6,14) AND t.table_mode >> 12 & 15 in (0,1) )__"))) { + if (OB_FAIL(table_schema.set_view_definition(R"__(select cast(db.database_name as CHAR(128)) as OWNER, cast(t.table_name as CHAR(128)) as TABLE_NAME, cast(subpart.sub_part_name as CHAR(128)) as SUBPARTITION_NAME, cast(c.column_name as CHAR(128)) as COLUMN_NAME, cast(hist.endpoint_num as NUMBER) as ENDPOINT_NUMBER, cast(NULL as NUMBER) as ENDPOINT_VALUE, cast(hist.endpoint_value as CHAR(4000)) as ENDPOINT_ACTUAL_VALUE, cast(hist.b_endpoint_value as CHAR(4000)) as ENDPOINT_ACTUAL_VALUE_RAW, cast(hist.endpoint_repeat_cnt as NUMBER) as ENDPOINT_REPEAT_COUNT FROM oceanbase.__all_table t JOIN oceanbase.__all_database db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id and t.tenant_id = 0 JOIN oceanbase.__all_column c ON c.tenant_id = t.tenant_id AND c.table_id = t.table_id JOIN oceanbase.__all_sub_part subpart on t.tenant_id = subpart.tenant_id and t.table_id = subpart.table_id JOIN oceanbase.__all_histogram_stat hist ON c.table_id = hist.table_id AND c.column_id = hist.column_id AND hist.partition_id = subpart.sub_part_id AND hist.object_type = 3 WHERE c.is_hidden = 0 AND t.table_type in (0,3,6,14) AND t.table_mode >> 12 & 15 in (0,1) )__"))) { LOG_ERROR("fail to set view_definition", K(ret)); } } diff --git a/src/share/inner_table/ob_inner_table_schema_def.py b/src/share/inner_table/ob_inner_table_schema_def.py index 39c57e10f7..1c03e289ce 100644 --- a/src/share/inner_table/ob_inner_table_schema_def.py +++ b/src/share/inner_table/ob_inner_table_schema_def.py @@ -23375,8 +23375,8 @@ def_table_schema( cast(stat.bucket_cnt as NUMBER) as NUM_BUCKETS, cast(stat.last_analyzed as DATETIME(6)) as LAST_ANALYZED, cast(stat.sample_size as NUMBER) as SAMPLE_SIZE, - CAST((CASE STAT.GLOBAL_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS GLOBAL_STATS, - CAST((CASE STAT.USER_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS USER_STATS, + CAST((CASE stat.GLOBAL_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS GLOBAL_STATS, + CAST((CASE stat.USER_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS USER_STATS, cast(NULL as CHAR(80)) as NOTES, cast(stat.avg_len as NUMBER) as AVG_COL_LEN, cast((case when stat.histogram_type = 1 then 'FREQUENCY' @@ -23390,7 +23390,7 @@ def_table_schema( TABLE_ID, TABLE_NAME FROM - OCEANBASE.__ALL_VIRTUAL_CORE_ALL_TABLE + oceanbase.__all_virtual_core_all_table WHERE TENANT_ID = EFFECTIVE_TENANT_ID() UNION ALL SELECT TENANT_ID, @@ -23398,12 +23398,12 @@ def_table_schema( table_id, table_name FROM oceanbase.__all_table where table_type in (0,2,3,6,14) - and table_mode >> 12 & 15 in (0,1)) T + and table_mode >> 12 & 15 in (0,1)) t JOIN oceanbase.__all_database db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id - AND T.TENANT_ID = 0 + and t.tenant_id = 0 JOIN (SELECT CAST(0 AS SIGNED) AS TENANT_ID, TABLE_ID, @@ -23453,8 +23453,8 @@ def_table_schema( cast(stat.bucket_cnt as NUMBER) as NUM_BUCKETS, cast(stat.last_analyzed as DATETIME(6)) as LAST_ANALYZED, cast(stat.sample_size as NUMBER) as SAMPLE_SIZE, - CAST((CASE STAT.GLOBAL_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS GLOBAL_STATS, - CAST((CASE STAT.USER_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS USER_STATS, + CAST((CASE stat.GLOBAL_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS GLOBAL_STATS, + CAST((CASE stat.USER_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS USER_STATS, cast(NULL as CHAR(80)) as NOTES, cast(stat.avg_len as NUMBER) as AVG_COL_LEN, cast((case when stat.histogram_type = 1 then 'FREQUENCY' @@ -23467,7 +23467,7 @@ def_table_schema( oceanbase.__all_database db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id - AND T.TENANT_ID = 0 + and t.tenant_id = 0 JOIN oceanbase.__all_column c ON c.tenant_id = t.tenant_id @@ -23511,8 +23511,8 @@ def_table_schema( cast(stat.bucket_cnt as NUMBER) as NUM_BUCKETS, cast(stat.last_analyzed as DATETIME(6)) as LAST_ANALYZED, cast(stat.sample_size as NUMBER) as SAMPLE_SIZE, - CAST((CASE STAT.GLOBAL_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS GLOBAL_STATS, - CAST((CASE STAT.USER_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS USER_STATS, + CAST((CASE stat.GLOBAL_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS GLOBAL_STATS, + CAST((CASE stat.USER_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END) AS CHAR(3)) AS USER_STATS, cast(NULL as CHAR(80)) as NOTES, cast(stat.avg_len as NUMBER) as AVG_COL_LEN, cast((case when stat.histogram_type = 1 then 'FREQUENCY' @@ -23525,7 +23525,7 @@ def_table_schema( oceanbase.__all_database db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id - AND T.TENANT_ID = 0 + and t.tenant_id = 0 JOIN oceanbase.__all_column c ON c.tenant_id = t.tenant_id @@ -23572,19 +23572,19 @@ def_table_schema( TABLE_ID, TABLE_NAME FROM - OCEANBASE.__ALL_VIRTUAL_CORE_ALL_TABLE + oceanbase.__all_virtual_core_all_table UNION ALL SELECT TENANT_ID, database_id, table_id, table_name FROM oceanbase.__all_table where table_type in (0,3,6,14) - and table_mode >> 12 & 15 in (0,1)) T + and table_mode >> 12 & 15 in (0,1)) t JOIN oceanbase.__all_database db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id - AND T.TENANT_ID = 0 + and t.tenant_id = 0 JOIN oceanbase.__all_column c ON c.tenant_id = t.tenant_id @@ -23624,7 +23624,7 @@ def_table_schema( oceanbase.__all_database db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id - AND T.TENANT_ID = 0 + and t.tenant_id = 0 JOIN oceanbase.__all_column c ON c.tenant_id = t.tenant_id @@ -23671,7 +23671,7 @@ def_table_schema( oceanbase.__all_database db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id - AND T.TENANT_ID = 0 + and t.tenant_id = 0 JOIN oceanbase.__all_column c ON c.tenant_id = t.tenant_id