This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 8e860a26a78 [fix](systable) fix unstable case for partitions table 
(#40553) (#41043)
8e860a26a78 is described below

commit 8e860a26a7817298377c4b233e126c20f2dd6fa7
Author: Mingyu Chen <[email protected]>
AuthorDate: Fri Sep 20 17:13:30 2024 +0800

    [fix](systable) fix unstable case for partitions table (#40553) (#41043)
    
    bp #40553
---
 .../schema_active_queries_scanner.cpp              |  2 +-
 .../exec/schema_scanner/schema_scanner_helper.cpp  | 22 ++++++++++------------
 be/src/exec/schema_scanner/schema_scanner_helper.h |  2 +-
 be/src/runtime/runtime_query_statistics_mgr.cpp    | 18 +++++++++---------
 .../workload_group/workload_group_manager.cpp      | 10 +++++-----
 .../java/org/apache/doris/catalog/SchemaTable.java |  3 ++-
 .../query_p0/system/test_partitions_schema.out     |  2 +-
 .../query_p0/system/test_partitions_schema.groovy  |  4 ++--
 8 files changed, 31 insertions(+), 32 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 6aa6e758999..6f66d9a8fd5 100644
--- a/be/src/exec/schema_scanner/schema_active_queries_scanner.cpp
+++ b/be/src/exec/schema_scanner/schema_active_queries_scanner.cpp
@@ -136,4 +136,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_scanner_helper.cpp 
b/be/src/exec/schema_scanner/schema_scanner_helper.cpp
index fc42044a29c..0fea9d8c39f 100644
--- a/be/src/exec/schema_scanner/schema_scanner_helper.cpp
+++ b/be/src/exec/schema_scanner/schema_scanner_helper.cpp
@@ -31,10 +31,9 @@ void SchemaScannerHelper::insert_string_value(int col_index, 
std::string str_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());
+    auto* nullable_column = 
assert_cast<vectorized::ColumnNullable*>(mutable_col_ptr.get());
     vectorized::IColumn* col_ptr = &nullable_column->get_nested_column();
-    
reinterpret_cast<vectorized::ColumnString*>(col_ptr)->insert_data(str_val.data(),
-                                                                      
str_val.size());
+    
assert_cast<vectorized::ColumnString*>(col_ptr)->insert_data(str_val.data(), 
str_val.size());
     nullable_column->get_null_map_data().emplace_back(0);
 }
 
@@ -42,21 +41,21 @@ void SchemaScannerHelper::insert_datetime_value(int 
col_index, const std::vector
                                                 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());
+    auto* nullable_column = 
assert_cast<vectorized::ColumnNullable*>(mutable_col_ptr.get());
     vectorized::IColumn* col_ptr = &nullable_column->get_nested_column();
     auto data = datas[0];
-    
reinterpret_cast<vectorized::ColumnVector<vectorized::Int64>*>(col_ptr)->insert_data(
+    
assert_cast<vectorized::ColumnVector<vectorized::Int64>*>(col_ptr)->insert_data(
             reinterpret_cast<char*>(data), 0);
     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());
+    auto* nullable_column = 
assert_cast<vectorized::ColumnNullable*>(mutable_col_ptr.get());
     vectorized::IColumn* col_ptr = &nullable_column->get_nested_column();
-    
reinterpret_cast<vectorized::ColumnVector<vectorized::Int64>*>(col_ptr)->insert_value(int_val);
+    
assert_cast<vectorized::ColumnVector<vectorized::Int64>*>(col_ptr)->insert_value(int_val);
     nullable_column->get_null_map_data().emplace_back(0);
 }
 
@@ -64,10 +63,9 @@ void SchemaScannerHelper::insert_double_value(int col_index, 
double double_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());
+    auto* nullable_column = 
assert_cast<vectorized::ColumnNullable*>(mutable_col_ptr.get());
     vectorized::IColumn* col_ptr = &nullable_column->get_nested_column();
-    
reinterpret_cast<vectorized::ColumnVector<vectorized::Float64>*>(col_ptr)->insert_value(
-            double_val);
+    
assert_cast<vectorized::ColumnVector<vectorized::Float64>*>(col_ptr)->insert_value(double_val);
     nullable_column->get_null_map_data().emplace_back(0);
 }
 } // namespace doris
diff --git a/be/src/exec/schema_scanner/schema_scanner_helper.h 
b/be/src/exec/schema_scanner/schema_scanner_helper.h
index c9fe8881ddb..f7b47ede91b 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 @@ public:
     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);
 };
 
diff --git a/be/src/runtime/runtime_query_statistics_mgr.cpp 
b/be/src/runtime/runtime_query_statistics_mgr.cpp
index 7e6a34ad1b5..95b6ee907e6 100644
--- a/be/src/runtime/runtime_query_statistics_mgr.cpp
+++ b/be/src/runtime/runtime_query_statistics_mgr.cpp
@@ -228,21 +228,21 @@ void 
RuntimeQueryStatiticsMgr::get_active_be_tasks_block(vectorized::Block* bloc
     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;
diff --git a/be/src/runtime/workload_group/workload_group_manager.cpp 
b/be/src/runtime/workload_group/workload_group_manager.cpp
index 62fcf0aad23..6df393e19e7 100644
--- a/be/src/runtime/workload_group/workload_group_manager.cpp
+++ b/be/src/runtime/workload_group/workload_group_manager.cpp
@@ -267,9 +267,9 @@ 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;
@@ -277,8 +277,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/fe/fe-core/src/main/java/org/apache/doris/catalog/SchemaTable.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/SchemaTable.java
index 5d6c01ea2a0..785343d78cb 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/SchemaTable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/SchemaTable.java
@@ -303,7 +303,8 @@ public class SchemaTable extends Table {
                                     .column("PARTITION_NAME", 
ScalarType.createVarchar(64))
                                     .column("SUBPARTITION_NAME", 
ScalarType.createVarchar(64))
                                     .column("PARTITION_ORDINAL_POSITION", 
ScalarType.createType(PrimitiveType.INT))
-                                    .column("SUBPARTITION_ORDINAL_POSITION", 
ScalarType.createType(PrimitiveType.INT))
+                                    .column("SUBPARTITION_ORDINAL_POSITION",
+                                            
ScalarType.createType(PrimitiveType.INT))
                                     .column("PARTITION_METHOD", 
ScalarType.createVarchar(13))
                                     .column("SUBPARTITION_METHOD", 
ScalarType.createVarchar(13))
                                     .column("PARTITION_EXPRESSION", 
ScalarType.createVarchar(2048))
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 898384e7793..a6c379ffc5b 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
+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 41446d2d0e1..0cf83d67e66 100644
--- a/regression-test/suites/query_p0/system/test_partitions_schema.groovy
+++ b/regression-test/suites/query_p0/system/test_partitions_schema.groovy
@@ -190,12 +190,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}\""""
     }
 
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to