deniskuzZ commented on code in PR #6961:
URL: https://github.com/apache/hive/pull/6961#discussion_r4669982421
##########
ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetaStoreClientQueryCache.java:
##########
@@ -201,6 +202,35 @@ public void testMissingTableLookedUpOncePerQuery() throws
Exception {
verify(delegate, times(2)).getTable(any(GetTableRequest.class));
}
+ @Test
+ public void testMissingTableLookedUpAgainAfterExecution() throws Exception {
+ String queryId = "test_missing_table_after_execution";
+ HiveConf conf = startQuery(queryId);
+ IMetaStoreClient delegate = tableDelegate();
+ // CTAS: the target is missing at compile time, then created by a task
while the cache is disabled
+ when(delegate.getTable(any(GetTableRequest.class)))
+ .thenThrow(new NoSuchObjectException("db.t not found"))
+ .thenReturn(new Table());
+ SessionHiveMetaStoreClient client =
SessionHiveMetaStoreClient.newClient(conf, delegate);
+
+ try {
+ client.getTable(hiveGetTableRequest());
+ fail("table should not be found");
+ } catch (NoSuchObjectException e) {
+ // compile time: the target does not exist yet
+ }
+
+ // as Executor.execute does around runTasks
Review Comment:
This copies what Executor.execute does around runTasks instead of running
it, so the test still passes if the dropTablesNotFound call in Executor is
removed or moved after disableHMSCache().
Could we add a test in this class that runs the query through Driver? For
example, run create table if not exists t (i int) with a post-exec hook that
calls Hive.get().getTable("default", "t").
Without the dropTablesNotFound call, the hook gets NoSuchObjectException
from the cached not-found entry.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]