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.
| 221 | // This test must select from a table because selecting directly from the sleep() function |
| 222 | // does not cause a timeout. |
| 223 | TEST(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. |
| 251 | TEST(InternalServerTest, InvalidQueryOption) { |
nothing calls this directly
no test coverage detected