[
https://issues.apache.org/jira/browse/DRILL-4956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15724515#comment-15724515
]
ASF GitHub Bot commented on DRILL-4956:
---------------------------------------
Github user paul-rogers commented on a diff in the pull request:
https://github.com/apache/drill/pull/666#discussion_r91012668
--- 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);
+ logger.info("Temporary table [{}] was dropped from schema
[{}]", tableName, schema.getFullSchemaName());
+ }
+ } catch (Exception e) {
+ logger.info("Problem during temporary table [{}] drop from
schema [{}]",
+ tableName, schema.getFullSchemaName(), e);
+ }
+ }
+ });
+ }
+
/**
* Implementations of this interface are allowed to increment queryCount.
* {@link org.apache.drill.exec.work.user.UserWorker} should have a
member that implements the interface.
* No other core class should implement this interface. Test classes may
implement (see ControlsInjectionUtil).
*/
- public static interface QueryCountIncrementer {
- public void increment(final UserSession session);
+ public interface QueryCountIncrementer {
+ void increment(final UserSession session);
--- End diff --
Nice catch!
> 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: Paul Rogers
> 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)