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

Method test_query_states

tests/query_test/test_observability.py:1264–1285  ·  view source on GitHub ↗

Tests that the query profile shows expected query states.

(self)

Source from the content-addressed store, hash-verified

1262 runtime profile."""
1263
1264 def test_query_states(self):
1265 """Tests that the query profile shows expected query states."""
1266 query = "select count(*) from functional.alltypes where bool_col = sleep(10)"
1267 handle = self.execute_query_async(query,
1268 {"debug_action": "AC_BEFORE_ADMISSION:SLEEP@1000"})
1269 # If ExecuteStatement() has completed and the query is paused in the admission control
1270 # phase, then the query must be in COMPILED state.
1271 profile = self.client.get_runtime_profile(handle)
1272 assert self.__is_line_in_profile("Query State: COMPILED", profile)
1273 assert self.__is_line_in_profile("Impala Query State: PENDING", profile)
1274 # After completion of the admission control phase, the query must have at least
1275 # reached RUNNING state.
1276 self.client.wait_for_admission_control(handle)
1277 profile = self.client.get_runtime_profile(handle)
1278 assert self.__is_line_in_profile("Query State: RUNNING", profile), profile
1279 assert self.__is_line_in_profile("Impala Query State: RUNNING", profile), profile
1280
1281 self.client.fetch(query, handle)
1282 profile = self.client.get_runtime_profile(handle)
1283 # After fetching the results, the query must be in state FINISHED.
1284 assert self.__is_line_in_profile("Query State: FINISHED", profile), profile
1285 assert self.__is_line_in_profile("Impala Query State: FINISHED", profile), profile
1286
1287 def test_error_query_state(self):
1288 """Tests that the query profile shows the proper error state."""

Callers

nothing calls this directly

Calls 5

__is_line_in_profileMethod · 0.95
execute_query_asyncMethod · 0.45
get_runtime_profileMethod · 0.45
fetchMethod · 0.45

Tested by

no test coverage detected