From e5533a5181e99694e6e83579fb555460b6707e70 Mon Sep 17 00:00:00 2001 From: morningman Date: Mon, 9 Sep 2024 17:17:58 +0800 Subject: [PATCH] 2 --- .../schema_active_queries_scanner.cpp | 10 +++++----- .../schema_partitions_scanner.cpp | 6 +++--- .../schema_scanner/schema_scanner_helper.cpp | 4 ++-- .../schema_scanner/schema_scanner_helper.h | 2 +- .../runtime/runtime_query_statistics_mgr.cpp | 20 +++++++++---------- .../workload_group/workload_group_manager.cpp | 10 +++++----- .../system/test_partitions_schema.out | 2 +- .../system/test_partitions_schema.groovy | 4 ++-- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/be/src/exec/schema_scanner/schema_active_queries_scanner.cpp b/be/src/exec/schema_scanner/schema_active_queries_scanner.cpp index 2b516fc6fdac2b2..76291fba36bf8e1 100644 --- a/be/src/exec/schema_scanner/schema_active_queries_scanner.cpp +++ b/be/src/exec/schema_scanner/schema_active_queries_scanner.cpp @@ -106,10 +106,10 @@ Status SchemaActiveQueriesScanner::_get_active_queries_block_from_fe() { _active_query_block.get()); SchemaScannerHelper::insert_string_value(1, row.column_value[1].stringVal, _active_query_block.get()); - SchemaScannerHelper::insert_int_value(2, row.column_value[2].longVal, - _active_query_block.get()); - SchemaScannerHelper::insert_int_value(3, row.column_value[3].longVal, - _active_query_block.get()); + SchemaScannerHelper::insert_int64_value(2, row.column_value[2].longVal, + _active_query_block.get()); + SchemaScannerHelper::insert_int64_value(3, row.column_value[3].longVal, + _active_query_block.get()); SchemaScannerHelper::insert_string_value(4, row.column_value[4].stringVal, _active_query_block.get()); SchemaScannerHelper::insert_string_value(5, row.column_value[5].stringVal, @@ -154,4 +154,4 @@ Status SchemaActiveQueriesScanner::get_next_block_internal(vectorized::Block* bl return Status::OK(); } -} // namespace doris \ No newline at end of file +} // namespace doris diff --git a/be/src/exec/schema_scanner/schema_partitions_scanner.cpp b/be/src/exec/schema_scanner/schema_partitions_scanner.cpp index 9f86fe6feb49d97..146a62135a28398 100644 --- a/be/src/exec/schema_scanner/schema_partitions_scanner.cpp +++ b/be/src/exec/schema_scanner/schema_partitions_scanner.cpp @@ -149,9 +149,9 @@ Status SchemaPartitionsScanner::get_onedb_info_from_fe(int64_t dbId) { TRow row = result_data[i]; for (int j = 0; j < _s_tbls_columns.size(); j++) { - if ((_s_tbls_columns[j].type == TYPE_BIGINT) || _s_tbls_columns[j].type == TYPE_INT) { - SchemaScannerHelper::insert_int_value(j, row.column_value[j].longVal, - _partitions_block.get()); + if (_s_tbls_columns[j].type == TYPE_BIGINT) { + SchemaScannerHelper::insert_int64_value(j, row.column_value[j].longVal, + _partitions_block.get()); } else if (_s_tbls_columns[j].type == TYPE_DATETIME) { std::vector datas(1); VecDateTimeValue src[1]; diff --git a/be/src/exec/schema_scanner/schema_scanner_helper.cpp b/be/src/exec/schema_scanner/schema_scanner_helper.cpp index fc42044a29c63f1..5f914ced04e6f45 100644 --- a/be/src/exec/schema_scanner/schema_scanner_helper.cpp +++ b/be/src/exec/schema_scanner/schema_scanner_helper.cpp @@ -50,8 +50,8 @@ void SchemaScannerHelper::insert_datetime_value(int col_index, const std::vector nullable_column->get_null_map_data().emplace_back(0); } -void SchemaScannerHelper::insert_int_value(int col_index, int64_t int_val, - vectorized::Block* block) { +void SchemaScannerHelper::insert_int64_value(int col_index, int64_t int_val, + vectorized::Block* block) { vectorized::MutableColumnPtr mutable_col_ptr; mutable_col_ptr = std::move(*block->get_by_position(col_index).column).assume_mutable(); auto* nullable_column = reinterpret_cast(mutable_col_ptr.get()); diff --git a/be/src/exec/schema_scanner/schema_scanner_helper.h b/be/src/exec/schema_scanner/schema_scanner_helper.h index c9fe8881ddb06e0..f7b47ede91bb5d3 100644 --- a/be/src/exec/schema_scanner/schema_scanner_helper.h +++ b/be/src/exec/schema_scanner/schema_scanner_helper.h @@ -35,7 +35,7 @@ class SchemaScannerHelper { static void insert_datetime_value(int col_index, const std::vector& datas, vectorized::Block* block); - static void insert_int_value(int col_index, int64_t int_val, vectorized::Block* block); + static void insert_int64_value(int col_index, int64_t int_val, vectorized::Block* block); static void insert_double_value(int col_index, double double_val, vectorized::Block* block); }; diff --git a/be/src/runtime/runtime_query_statistics_mgr.cpp b/be/src/runtime/runtime_query_statistics_mgr.cpp index 84a552e45173c47..77fd80cd528998e 100644 --- a/be/src/runtime/runtime_query_statistics_mgr.cpp +++ b/be/src/runtime/runtime_query_statistics_mgr.cpp @@ -521,21 +521,21 @@ void RuntimeQueryStatisticsMgr::get_active_be_tasks_block(vectorized::Block* blo for (auto& [query_id, qs_ctx_ptr] : _query_statistics_ctx_map) { TQueryStatistics tqs; qs_ctx_ptr->collect_query_statistics(&tqs); - SchemaScannerHelper::insert_int_value(0, be_id, block); + SchemaScannerHelper::insert_int64_value(0, be_id, block); SchemaScannerHelper::insert_string_value(1, qs_ctx_ptr->_fe_addr.hostname, block); SchemaScannerHelper::insert_string_value(2, query_id, block); int64_t task_time = qs_ctx_ptr->_is_query_finished ? qs_ctx_ptr->_query_finish_time - qs_ctx_ptr->_query_start_time : MonotonicMillis() - qs_ctx_ptr->_query_start_time; - SchemaScannerHelper::insert_int_value(3, task_time, block); - SchemaScannerHelper::insert_int_value(4, tqs.cpu_ms, block); - SchemaScannerHelper::insert_int_value(5, tqs.scan_rows, block); - SchemaScannerHelper::insert_int_value(6, tqs.scan_bytes, block); - SchemaScannerHelper::insert_int_value(7, tqs.max_peak_memory_bytes, block); - SchemaScannerHelper::insert_int_value(8, tqs.current_used_memory_bytes, block); - SchemaScannerHelper::insert_int_value(9, tqs.shuffle_send_bytes, block); - SchemaScannerHelper::insert_int_value(10, tqs.shuffle_send_rows, block); + SchemaScannerHelper::insert_int64_value(3, task_time, block); + SchemaScannerHelper::insert_int64_value(4, tqs.cpu_ms, block); + SchemaScannerHelper::insert_int64_value(5, tqs.scan_rows, block); + SchemaScannerHelper::insert_int64_value(6, tqs.scan_bytes, block); + SchemaScannerHelper::insert_int64_value(7, tqs.max_peak_memory_bytes, block); + SchemaScannerHelper::insert_int64_value(8, tqs.current_used_memory_bytes, block); + SchemaScannerHelper::insert_int64_value(9, tqs.shuffle_send_bytes, block); + SchemaScannerHelper::insert_int64_value(10, tqs.shuffle_send_rows, block); std::stringstream ss; ss << qs_ctx_ptr->_query_type; @@ -543,4 +543,4 @@ void RuntimeQueryStatisticsMgr::get_active_be_tasks_block(vectorized::Block* blo } } -} // namespace doris \ No newline at end of file +} // namespace doris diff --git a/be/src/runtime/workload_group/workload_group_manager.cpp b/be/src/runtime/workload_group/workload_group_manager.cpp index 393d327e7c42ca4..32470fed5ab929b 100644 --- a/be/src/runtime/workload_group/workload_group_manager.cpp +++ b/be/src/runtime/workload_group/workload_group_manager.cpp @@ -255,9 +255,9 @@ void WorkloadGroupMgr::get_wg_resource_usage(vectorized::Block* block) { std::shared_lock r_lock(_group_mutex); block->reserve(_workload_groups.size()); for (const auto& [id, wg] : _workload_groups) { - SchemaScannerHelper::insert_int_value(0, be_id, block); - SchemaScannerHelper::insert_int_value(1, wg->id(), block); - SchemaScannerHelper::insert_int_value(2, wg->get_mem_used(), block); + SchemaScannerHelper::insert_int64_value(0, be_id, block); + SchemaScannerHelper::insert_int64_value(1, wg->id(), block); + SchemaScannerHelper::insert_int64_value(2, wg->get_mem_used(), block); double cpu_usage_p = (double)wg->get_cpu_usage() / (double)total_cpu_time_ns_per_second * 100; @@ -265,8 +265,8 @@ void WorkloadGroupMgr::get_wg_resource_usage(vectorized::Block* block) { SchemaScannerHelper::insert_double_value(3, cpu_usage_p, block); - SchemaScannerHelper::insert_int_value(4, wg->get_local_scan_bytes_per_second(), block); - SchemaScannerHelper::insert_int_value(5, wg->get_remote_scan_bytes_per_second(), block); + SchemaScannerHelper::insert_int64_value(4, wg->get_local_scan_bytes_per_second(), block); + SchemaScannerHelper::insert_int64_value(5, wg->get_remote_scan_bytes_per_second(), block); } } diff --git a/regression-test/data/query_p0/system/test_partitions_schema.out b/regression-test/data/query_p0/system/test_partitions_schema.out index ea82818d2ab2b0f..781be7e41eefd17 100644 --- a/regression-test/data/query_p0/system/test_partitions_schema.out +++ b/regression-test/data/query_p0/system/test_partitions_schema.out @@ -42,7 +42,7 @@ internal test_partitions_schema_db test_row_column_page_size1 test_row_column_pa -- !select_check_3 -- -- !select_check_4 -- -internal test_partitions_schema_db duplicate_table duplicate_table NULL 0 0 UNPARTITIONED NULL NULL NULL NULL -1 0 0 0 0 0 0 +internal test_partitions_schema_db duplicate_table duplicate_table -- !select_check_5 -- diff --git a/regression-test/suites/query_p0/system/test_partitions_schema.groovy b/regression-test/suites/query_p0/system/test_partitions_schema.groovy index ac73d3315d0dfbc..0215bc8756776a1 100644 --- a/regression-test/suites/query_p0/system/test_partitions_schema.groovy +++ b/regression-test/suites/query_p0/system/test_partitions_schema.groovy @@ -184,12 +184,12 @@ suite("test_partitions_schema") { sql "GRANT SELECT_PRIV ON ${dbName}.duplicate_table TO ${user}" connect(user=user, password='123abc!@#', url=url) { - qt_select_check_4 """select $listOfColum from information_schema.partitions where table_schema=\"${dbName}\" order by $listOfColum""" + order_qt_select_check_4 """select TABLE_CATALOG,TABLE_SCHEMA,TABLE_NAME,PARTITION_NAME from information_schema.partitions where table_schema=\"${dbName}\"""" } sql "REVOKE SELECT_PRIV ON ${dbName}.duplicate_table FROM ${user}" connect(user=user, password='123abc!@#', url=url) { - qt_select_check_5 """select $listOfColum from information_schema.partitions where table_schema=\"${dbName}\" order by $listOfColum""" + order_qt_select_check_5 """select TABLE_CATALOG,TABLE_SCHEMA,TABLE_NAME,PARTITION_NAME from information_schema.partitions where table_schema=\"${dbName}\"""" } }