Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/666#discussion_r91012427 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserSession.java --- @@ -55,13 +61,37 @@ private OptionManager sessionOptions; private final AtomicInteger queryCount; + /** Unique session identifier used as suffix in temporary table names. */ + private final String uuid; + /** Cache that stores all temporary tables by schema names. */ + private final TemporaryTablesCache temporaryTablesCache; + + /** On session close drops all temporary tables from their schemas and clears temporary tables cache. */ + @Override + public void close() { + temporaryTablesCache.removeAll(new BiConsumer<AbstractSchema, String>() { + @Override + public void accept(AbstractSchema schema, String tableName) { + try { + if (schema.isAccessible() && schema.getTable(tableName) != null) { --- End diff -- Not sure what `isAccessible()` does... But, if it allows a temp table to be created, then presumably it had the same value when we attempted to create the temp table, so we should not have created a temp table in it if it is not accessible? Also, can accessibility change during a query run? Start as accessible, but become inaccessible by the time we (try to) delete the temp table?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---