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

dbecker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 4553e89ed42880fc3930eb937e847074e3b70039
Author: Riza Suminto <[email protected]>
AuthorDate: Wed Oct 23 19:26:15 2024 -0700

    IMPALA-13477: Set request_pool in QueryStateRecord for CTAS query
    
    Resource Pool information for CTAS query is missing from /queries page
    of WebUI. This is because CTAS query has TExecRequest.stmt_type = DDL.
    However, CTAS also has TQueryExecRequest.stmt_type = DML and subject to
    AdmissionControl. Therefore, its request pool must be recorded into
    QueryStateRecord and displayed at /queries page of WebUI.
    
    Testing:
    - Update assertion in test_executor_groups.py to reflect this change.
    - Pass core tests.
    
    Change-Id: I6885192f1c2d563e58670f142b3c0df528032a6e
    Reviewed-on: http://gerrit.cloudera.org:8080/21975
    Reviewed-by: Jason Fehr <[email protected]>
    Reviewed-by: Wenzhe Zhou <[email protected]>
    Tested-by: Impala Public Jenkins <[email protected]>
---
 be/src/service/query-state-record.cc         | 7 +++++--
 tests/custom_cluster/test_executor_groups.py | 8 ++++----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/be/src/service/query-state-record.cc 
b/be/src/service/query-state-record.cc
index 0923bfaf3..9c23d1c10 100644
--- a/be/src/service/query-state-record.cc
+++ b/be/src/service/query-state-record.cc
@@ -118,8 +118,11 @@ void QueryStateRecord::Init(const ClientRequestState& 
query_handle) {
   last_active_time_ms = query_handle.last_active_ms();
   // For statement types other than QUERY/DML, show an empty string for 
resource pool
   // to indicate that they are not subjected to admission control.
-  // TODO: CTAS query has stmt_type == DDL, but query_exec_request.stmt_type 
== DML.
-  if (stmt_type == TStmtType::QUERY || stmt_type == TStmtType::DML) {
+  // CTAS query has stmt_type == DDL and query_exec_request.stmt_type == DML,
+  // so resource pool should be displayed too.
+  if (stmt_type == TStmtType::QUERY || stmt_type == TStmtType::DML
+      || (stmt_type == TStmtType::DDL
+          && request.query_exec_request.stmt_type == TStmtType::DML)) {
     resource_pool = query_handle.request_pool();
   }
   user_has_profile_access = query_handle.user_has_profile_access();
diff --git a/tests/custom_cluster/test_executor_groups.py 
b/tests/custom_cluster/test_executor_groups.py
index f67d3988c..e30b943ef 100644
--- a/tests/custom_cluster/test_executor_groups.py
+++ b/tests/custom_cluster/test_executor_groups.py
@@ -1250,7 +1250,7 @@ class TestExecutorGroups(CustomClusterTestSuite):
     # END test slot count strategy
 
     # Check resource pools on the Web queries site and admission site
-    self._verify_query_num_for_resource_pool("root.tiny", 17)
+    self._verify_query_num_for_resource_pool("root.tiny", 18)
     self._verify_query_num_for_resource_pool("root.small", 3)
     self._verify_query_num_for_resource_pool("root.large", 7)
     self._verify_total_admitted_queries("root.tiny", 18)
@@ -1389,9 +1389,9 @@ class TestExecutorGroups(CustomClusterTestSuite):
     self.__verify_fs_writers(result, 1, [0, 1])
     # END testing insert + MAX_FS_WRITER
 
-    self._verify_query_num_for_resource_pool("root.tiny", 1)
-    self._verify_query_num_for_resource_pool("root.small", 2)
-    self._verify_query_num_for_resource_pool("root.large", 1)
+    self._verify_query_num_for_resource_pool("root.tiny", 4)
+    self._verify_query_num_for_resource_pool("root.small", 3)
+    self._verify_query_num_for_resource_pool("root.large", 4)
     self._verify_total_admitted_queries("root.tiny", 4)
     self._verify_total_admitted_queries("root.small", 3)
     self._verify_total_admitted_queries("root.large", 4)

Reply via email to