Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1E13E200BE1 for ; Mon, 19 Dec 2016 16:05:04 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 1CA9A160B35; Mon, 19 Dec 2016 15:05:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8786A160B18 for ; Mon, 19 Dec 2016 16:05:03 +0100 (CET) Received: (qmail 59074 invoked by uid 500); 19 Dec 2016 15:05:01 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 58363 invoked by uid 99); 19 Dec 2016 15:05:00 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Dec 2016 15:05:00 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B107BDFBAF; Mon, 19 Dec 2016 15:05:00 +0000 (UTC) From: arina-ielchiieva To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request #666: DRILL-4956: Temporary tables support Content-Type: text/plain Message-Id: <20161219150500.B107BDFBAF@git1-us-west.apache.org> Date: Mon, 19 Dec 2016 15:05:00 +0000 (UTC) archived-at: Mon, 19 Dec 2016 15:05:04 -0000 Github user arina-ielchiieva commented on a diff in the pull request: https://github.com/apache/drill/pull/666#discussion_r91952394 --- 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() { + @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 [{}]", --- End diff -- Such syntax was used before so I decided not to change it, for example, check TestCTAS. --- 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 infrastructure@apache.org or file a JIRA ticket with INFRA. ---