Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/795#discussion_r108051767 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/SchemaTreeProvider.java --- @@ -119,6 +127,74 @@ public SchemaPlus createRootSchema(SchemaConfig schemaConfig) { } } + + public SchemaPlus createPartialRootSchema(final String userName, final SchemaConfigInfoProvider provider, + final String storage) { + final String schemaUser = isImpersonationEnabled ? userName : ImpersonationUtil.getProcessUserName(); --- End diff -- Please move the user resolution into a method rather than duplicating the code. More broadly, wouldn't the answer here be a constant for any qiven query? So, there is no reason to keep recomputing it. Can we just do it once and save it somewhere? Let's think. If this whole structure is for a single query, then the user is constant and can be stored in the object itself. Is this the only place where we need to figure out impersonation and actual user? If not, then the setup should be done at a higher level, not in each place where it is needed. Perhaps we need a UserIdentity class that has the loginName and effectiveName, where these are the same for non-impersonation, but differ for impersonation.
--- 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. ---