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 D702C200C51 for ; Sun, 26 Mar 2017 07:46:27 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D5A1B160B9C; Sun, 26 Mar 2017 05:46:27 +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 288ED160B88 for ; Sun, 26 Mar 2017 07:46:27 +0200 (CEST) Received: (qmail 79607 invoked by uid 500); 26 Mar 2017 05:46:25 -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 79172 invoked by uid 99); 26 Mar 2017 05:46:24 -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; Sun, 26 Mar 2017 05:46:24 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1EC29E0896; Sun, 26 Mar 2017 05:46:24 +0000 (UTC) From: paul-rogers To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request #795: DRILL-5089: Get only partial schemas of relevant st... Content-Type: text/plain Message-Id: <20170326054624.1EC29E0896@git1-us-west.apache.org> Date: Sun, 26 Mar 2017 05:46:24 +0000 (UTC) archived-at: Sun, 26 Mar 2017 05:46:28 -0000 Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/795#discussion_r108052368 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/ops/QueryContext.java --- @@ -144,6 +145,25 @@ public SchemaPlus getNewDefaultSchema() { return defaultSchema; } + public SchemaPlus getPartialDefaultSchema() { + + final String sessionSchemaPath = session.getDefaultSchemaPath(); + final List schemaPathAsList = Lists.newArrayList(sessionSchemaPath.split("\\.")); + + final SchemaPlus rootSchema = schemaTreeProvider.createPartialRootSchema(getQueryUserName(), + this, schemaPathAsList.get(0)); + + final SchemaPlus defaultSchema = session.getDefaultSchema(rootSchema); + + if (defaultSchema == null) { + return rootSchema; + } + return defaultSchema; + } + + public void addNewRelevantSchema(Set storages, SchemaPlus toExpandSchema) { + schemaTreeProvider.addPartialRootSchema(getQueryUserName(), this, storages, toExpandSchema); --- End diff -- Per a comment later on, find a good home for computing the effective user name (with impersonation enabled). That calculation should probably be done on the user session if the impersonation is for the life of the session, or on the query context if the impersonation is only for the single query. (Note that if it is only for a query, temp tables probably won't work the way we expect.) But, doing the impersonation check in the schema tree provider is pushing that behavior too far down into the code. --- 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. ---