Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1032#discussion_r150683680
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/SchemaTreeProvider.java
 ---
    @@ -105,12 +106,36 @@ public SchemaPlus createRootSchema(final String 
userName, final SchemaConfigInfo
        * @return
        */
       public SchemaPlus createRootSchema(SchemaConfig schemaConfig) {
    +      final SchemaPlus rootSchema = 
DynamicSchema.createRootSchema(dContext.getStorage(), schemaConfig);
    +      schemaTreesToClose.add(rootSchema);
    +      return rootSchema;
    +  }
    +
    +  /**
    +   * Return full root schema with schema owner as the given user.
    +   *
    +   * @param userName Name of the user who is accessing the storage sources.
    +   * @param provider {@link SchemaConfigInfoProvider} instance
    +   * @return Root of the schema tree.
    +   */
    +  public SchemaPlus createFullRootSchema(final String userName, final 
SchemaConfigInfoProvider provider) {
    +    final String schemaUser = isImpersonationEnabled ? userName : 
ImpersonationUtil.getProcessUserName();
    --- End diff --
    
    Should this be factored out somewhere? Seems this magic stanza will be 
needed in many places: better to have one copy than several. Maybe a method in 
`ImpersonationUtil`?


---

Reply via email to