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

Function TEST

be/src/service/internal-server-test.cc:223–248  ·  view source on GitHub ↗

Asserts that a timeout error is returned if the query times out during execution. This test must select from a table because selecting directly from the sleep() function does not cause a timeout.

Source from the content-addressed store, hash-verified

221// This test must select from a table because selecting directly from the sleep() function
222// does not cause a timeout.
223TEST(InternalServerTest, QueryTimeout) {
224 DatabaseTest db_test = DatabaseTest(impala_server_, "query_timeout", true, 5);
225 InternalServer* fixture = impala_server_.get();
226
227 TUniqueId session_id;
228 TUniqueId query_id;
229
230 ASSERT_OK(fixture->OpenSession("impala", session_id,
231 {{TImpalaQueryOptions::FETCH_ROWS_TIMEOUT_MS, "1"}}));
232
233 // Run a query that will execute for longer than the configured exec timeout.
234 ASSERT_OK(fixture->SubmitQuery(StrCat("select * from ", db_test.GetTableName(),
235 " where id=sleep(2000000)"), session_id, query_id));
236
237 Status stat = fixture->WaitForResults(query_id);
238
239 // Assert the expected timeout error was returned.
240 EXPECT_FALSE(stat.ok());
241 EXPECT_EQ(TErrorCode::GENERAL, stat.code());
242 EXPECT_EQ("query timed out waiting for results", stat.msg().msg());
243
244 fixture->CloseQuery(query_id);
245 fixture->CloseSession(session_id);
246
247 assertQueryState(query_id, QUERY_STATE_FAILED);
248} // TEST QueryTimeout
249
250// Asserts the expected error is returned when a query option is set to an invalid value.
251TEST(InternalServerTest, InvalidQueryOption) {

Callers

nothing calls this directly

Calls 15

DatabaseTestClass · 0.85
assertQueryStateFunction · 0.85
PrintIdFunction · 0.85
CreateClass · 0.85
GetCurrentTimeMicrosFunction · 0.85
SubmitQueryMethod · 0.80
GetTableNameMethod · 0.80
codeMethod · 0.80
CloseQueryMethod · 0.80
GetDbNameMethod · 0.80
ExecuteAndFetchAllHS2Method · 0.80
ExecuteIgnoreResultsMethod · 0.80

Tested by

no test coverage detected