Repository: incubator-impala
Updated Branches:
  refs/heads/master 9d1e4449c -> daff8eb0c


IMPALA-4276: Profile displays non-default query options set by planner

Fix to populate the non-default query options set by planner in the
runtime profile.

Added a corresponding test case.

Change-Id: I08e9dc2bebb83101976bbbd903ee48c5068dbaab
Reviewed-on: http://gerrit.cloudera.org:8080/7419
Reviewed-by: Matthew Jacobs <[email protected]>
Tested-by: Impala Public Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/83bfc142
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/83bfc142
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/83bfc142

Branch: refs/heads/master
Commit: 83bfc142e45e6394b30f712f90d201ea57eecc02
Parents: 9d1e444
Author: Bikramjeet Vig <[email protected]>
Authored: Thu Jul 13 15:21:37 2017 -0700
Committer: Impala Public Jenkins <[email protected]>
Committed: Fri Jul 21 01:14:07 2017 +0000

----------------------------------------------------------------------
 be/src/service/client-request-state.cc            |  2 +-
 tests/custom_cluster/test_admission_controller.py |  7 ++++---
 tests/query_test/test_observability.py            | 17 ++++++++++++++++-
 3 files changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/83bfc142/be/src/service/client-request-state.cc
----------------------------------------------------------------------
diff --git a/be/src/service/client-request-state.cc 
b/be/src/service/client-request-state.cc
index c454ebe..6be04f6 100644
--- a/be/src/service/client-request-state.cc
+++ b/be/src/service/client-request-state.cc
@@ -148,7 +148,7 @@ Status ClientRequestState::Exec(TExecRequest* exec_request) 
{
   profile_.AddChild(&server_profile_);
   summary_profile_.AddInfoString("Query Type", PrintTStmtType(stmt_type()));
   summary_profile_.AddInfoString("Query Options (non default)",
-      DebugQueryOptions(query_ctx_.client_request.query_options));
+      DebugQueryOptions(exec_request_.query_options));
 
   switch (exec_request->stmt_type) {
     case TStmtType::QUERY:

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/83bfc142/tests/custom_cluster/test_admission_controller.py
----------------------------------------------------------------------
diff --git a/tests/custom_cluster/test_admission_controller.py 
b/tests/custom_cluster/test_admission_controller.py
index e84db52..b9ae427 100644
--- a/tests/custom_cluster/test_admission_controller.py
+++ b/tests/custom_cluster/test_admission_controller.py
@@ -144,15 +144,16 @@ class 
TestAdmissionController(TestAdmissionControllerBase, HS2TestSuite):
       assert re.search(expected_error_re, str(e))
 
   def __check_query_options(self, profile, expected_query_options):
-    """Validate that the per-pool query options were set on the specified 
profile.
-    expected_query_options is a list of "KEY=VALUE" strings, e.g. 
["MEM_LIMIT=1", ...]"""
+    """Validate that the expected per-pool query options were set on the 
specified
+    profile. expected_query_options is a list of "KEY=VALUE" strings, e.g.
+    ["MEM_LIMIT=1", ...]"""
     confs = []
     for line in profile.split("\n"):
       if PROFILE_QUERY_OPTIONS_KEY in line:
         rhs = re.split(": ", line)[1]
         confs = re.split(",", rhs)
         break
-    assert len(confs) == len(expected_query_options)
+    assert len(confs) >= len(expected_query_options)
     confs = map(str.lower, confs)
     for expected in expected_query_options:
       assert expected.lower() in confs,\

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/83bfc142/tests/query_test/test_observability.py
----------------------------------------------------------------------
diff --git a/tests/query_test/test_observability.py 
b/tests/query_test/test_observability.py
index cdb322d..5a82a25 100644
--- a/tests/query_test/test_observability.py
+++ b/tests/query_test/test_observability.py
@@ -79,7 +79,7 @@ class TestObservability(ImpalaTestSuite):
     assert result.exec_summary[scan_idx]['operator'] == '00:SCAN HBASE'
     assert result.exec_summary[scan_idx]['detail'] == 
'functional_hbase.alltypestiny'
 
-  def test_get_profile(self):
+  def test_query_states(self):
     """Tests that the query profile shows expected query states."""
     query = "select count(*) from functional.alltypes"
     handle = self.execute_query_async(query, dict())
@@ -93,3 +93,18 @@ class TestObservability(ImpalaTestSuite):
     profile = self.client.get_runtime_profile(handle)
     # After fetching the results, the query must be in state FINISHED.
     assert "Query State: FINISHED" in profile, profile
+
+  def test_query_options(self):
+    """Test that the query profile shows expected non-default query options, 
both set
+    explicitly through client and those set by planner"""
+    # Set a query option explicitly through client
+    self.execute_query("set mem_limit = 8589934592")
+    # For this query, the planner sets NUM_NODES=1, NUM_SCANNER_THREADS=1 and
+    # RUNTIME_FILTER_MODE=0
+    expected_string = "Query Options (non default): 
MEM_LIMIT=8589934592,NUM_NODES=1," \
+        "NUM_SCANNER_THREADS=1,RUNTIME_FILTER_MODE=0,MT_DOP=0\n"
+    assert expected_string in self.execute_query("select 1").runtime_profile
+
+    # Make sure explicitly set default values are not shown in the profile
+    self.execute_query("set MAX_IO_BUFFERS = 0")
+    assert expected_string in self.execute_query("select 1").runtime_profile

Reply via email to