MCPcopy Create free account
hub / github.com/apache/impala / __test_invalid_result_caching

Method __test_invalid_result_caching

tests/hs2/test_fetch_first.py:35–67  ·  view source on GitHub ↗

Tests that invalid requests for query-result caching fail using the given sql_stmt.

(self, sql_stmt)

Source from the content-addressed store, hash-verified

33 IMPALA_RESULT_CACHING_OPT = "impala.resultset.cache.size"
34
35 def __test_invalid_result_caching(self, sql_stmt):
36 """ Tests that invalid requests for query-result caching fail
37 using the given sql_stmt."""
38 impala_cluster = ImpalaCluster.get_e2e_test_cluster()
39 impalad = impala_cluster.impalads[0].service
40
41 execute_statement_req = TCLIService.TExecuteStatementReq()
42 execute_statement_req.sessionHandle = self.session_handle
43 execute_statement_req.statement = sql_stmt
44 execute_statement_req.confOverlay = dict()
45
46 # Test that a malformed result-cache size returns an error.
47 execute_statement_req.confOverlay[self.IMPALA_RESULT_CACHING_OPT] = "bad_number"
48 execute_statement_resp = self.hs2_client.ExecuteStatement(execute_statement_req)
49 HS2TestSuite.check_response(execute_statement_resp,
50 TCLIService.TStatusCode.ERROR_STATUS,
51 "Invalid value 'bad_number' for 'impala.resultset.cache.size' option")
52 self.__verify_num_cached_rows(0)
53 self.assert_eventually(30, 1,
54 lambda: 0 == impalad.get_num_in_flight_queries(),
55 "Num in flight queries did not reach 0")
56
57 # Test that a result-cache size exceeding the per-Impalad maximum returns an error.
58 # The default maximum result-cache size is 100000.
59 execute_statement_req.confOverlay[self.IMPALA_RESULT_CACHING_OPT] = "100001"
60 execute_statement_resp = self.hs2_client.ExecuteStatement(execute_statement_req)
61 HS2TestSuite.check_response(execute_statement_resp,
62 TCLIService.TStatusCode.ERROR_STATUS,
63 "Requested result-cache size of 100001 exceeds Impala's maximum of 100000")
64 self.__verify_num_cached_rows(0)
65 self.assert_eventually(30, 1,
66 lambda: 0 == impalad.get_num_in_flight_queries(),
67 "Num in flight queries did not reach 0")
68
69 def __verify_num_cached_rows(self, num_cached_rows):
70 """Asserts that Impala has the given number of rows in its result set cache. Also

Callers 2

run_query_stmts_testMethod · 0.95
test_non_query_stmtsMethod · 0.95

Calls 6

get_e2e_test_clusterMethod · 0.80
check_responseMethod · 0.80
assert_eventuallyMethod · 0.80
ExecuteStatementMethod · 0.45

Tested by

no test coverage detected