[ https://issues.apache.org/jira/browse/DRILL-4956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15761391#comment-15761391 ]
ASF GitHub Bot commented on DRILL-4956: --------------------------------------- Github user arina-ielchiieva commented on a diff in the pull request: https://github.com/apache/drill/pull/666#discussion_r92195973 --- 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) { + schema.dropTable(tableName); --- End diff -- Will add race condition check. > Temporary tables support > ------------------------ > > Key: DRILL-4956 > URL: https://issues.apache.org/jira/browse/DRILL-4956 > Project: Apache Drill > Issue Type: Improvement > Affects Versions: 1.8.0 > Reporter: Arina Ielchiieva > Assignee: Arina Ielchiieva > Labels: doc-impacting > Fix For: Future > > > Link to design doc - > https://docs.google.com/document/d/1gSRo_w6q2WR5fPx7SsQ5IaVmJXJ6xCOJfYGyqpVOC-g/edit -- This message was sent by Atlassian JIRA (v6.3.4#6332)