Skip to content

Commit

Permalink
2
Browse files Browse the repository at this point in the history
  • Loading branch information
morningman committed Sep 9, 2024
1 parent 446ec1d commit e5533a5
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 29 deletions.
10 changes: 5 additions & 5 deletions be/src/exec/schema_scanner/schema_active_queries_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -154,4 +154,4 @@ Status SchemaActiveQueriesScanner::get_next_block_internal(vectorized::Block* bl
return Status::OK();
}

} // namespace doris
} // namespace doris
6 changes: 3 additions & 3 deletions be/src/exec/schema_scanner/schema_partitions_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<void*> datas(1);
VecDateTimeValue src[1];
Expand Down
4 changes: 2 additions & 2 deletions be/src/exec/schema_scanner/schema_scanner_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<vectorized::ColumnNullable*>(mutable_col_ptr.get());
Expand Down
2 changes: 1 addition & 1 deletion be/src/exec/schema_scanner/schema_scanner_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class SchemaScannerHelper {
static void insert_datetime_value(int col_index, const std::vector<void*>& 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);
};

Expand Down
20 changes: 10 additions & 10 deletions be/src/runtime/runtime_query_statistics_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,26 +521,26 @@ 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;
SchemaScannerHelper::insert_string_value(11, ss.str(), block);
}
}

} // namespace doris
} // namespace doris
10 changes: 5 additions & 5 deletions be/src/runtime/workload_group/workload_group_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,18 +255,18 @@ void WorkloadGroupMgr::get_wg_resource_usage(vectorized::Block* block) {
std::shared_lock<std::shared_mutex> 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;
cpu_usage_p = std::round(cpu_usage_p * 100.0) / 100.0;

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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 --

Original file line number Diff line number Diff line change
Expand Up @@ -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}\""""
}

}

0 comments on commit e5533a5

Please sign in to comment.