This is an automated email from the ASF dual-hosted git repository.
joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
The following commit(s) were added to refs/heads/master by this push:
new 2a19acf73 IMPALA-11938: Raised error if NUM_NODES is set to invalid
value.
2a19acf73 is described below
commit 2a19acf73453220374e93b292b847a3dcf1fb2a5
Author: Anshula Jain <[email protected]>
AuthorDate: Thu Mar 14 21:24:28 2024 +0530
IMPALA-11938: Raised error if NUM_NODES is set to invalid value.
If NUM_NODES is set to a value other than 0 or 1 below error is raised
ERROR: Invalid value for query option NUM_NODES: <value> is not in range
[0, 1]
Change-Id: Ib283ae350875a7ac217490c216a26281f1bb4812
Reviewed-on: http://gerrit.cloudera.org:8080/21147
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
---
be/src/service/query-options-test.cc | 1 +
be/src/service/query-options.cc | 3 ++-
tests/hs2/test_hs2.py | 2 +-
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/be/src/service/query-options-test.cc
b/be/src/service/query-options-test.cc
index badeac2e7..f396f3e6a 100644
--- a/be/src/service/query-options-test.cc
+++ b/be/src/service/query-options-test.cc
@@ -270,6 +270,7 @@ TEST(QueryOptions, SetIntOptions) {
{1, qc.MAX_FRAGMENT_INSTANCES_PER_NODE}},
{MAKE_OPTIONDEF(max_num_filters_aggregated_per_host),
{-1, I32_MAX}},
+ {MAKE_OPTIONDEF(num_nodes), {0, 1}},
};
for (const auto& test_case : case_set) {
const OptionDef<int32_t>& option_def = test_case.first;
diff --git a/be/src/service/query-options.cc b/be/src/service/query-options.cc
index 7f834b38f..468aaf36a 100644
--- a/be/src/service/query-options.cc
+++ b/be/src/service/query-options.cc
@@ -243,7 +243,8 @@ Status impala::SetQueryOption(const string& key, const
string& value,
};
case TImpalaQueryOptions::NUM_NODES: {
int32_t int32_t_val = 0;
- RETURN_IF_ERROR(QueryOptionParser::Parse<int32_t>(option, value,
&int32_t_val));
+
RETURN_IF_ERROR(QueryOptionParser::ParseAndCheckInclusiveRange<int32_t>(
+ option, value, 0, 1, &int32_t_val));
query_options->__set_num_nodes(int32_t_val);
break;
};
diff --git a/tests/hs2/test_hs2.py b/tests/hs2/test_hs2.py
index 270c6d0da..ba0892b17 100644
--- a/tests/hs2/test_hs2.py
+++ b/tests/hs2/test_hs2.py
@@ -72,7 +72,7 @@ class TestHS2(HS2TestSuite):
def test_open_session_query_options(self):
"""Check that OpenSession sets query options"""
- configuration = {'MAX_ERRORS': '45678', 'NUM_NODES': '1234',
+ configuration = {'MAX_ERRORS': '45678', 'NUM_NODES': '1',
'MAX_NUM_RUNTIME_FILTERS': '333'}
with ScopedSession(self.hs2_client, configuration=configuration) as
session:
TestHS2.check_response(session)