Class DrillHiveMetaStoreClientFactory

java.lang.Object
org.apache.drill.exec.store.hive.client.DrillHiveMetaStoreClientFactory

public final class DrillHiveMetaStoreClientFactory extends Object
Provides factory methods for initialization of DrillHiveMetaStoreClient instances.
  • Method Details

    • createClientWithAuthz

      public static DrillHiveMetaStoreClient createClientWithAuthz(DrillHiveMetaStoreClient processUserMetaStoreClient, org.apache.hadoop.hive.conf.HiveConf hiveConf, String userName)
      Create a DrillHiveMetaStoreClient for cases where: 1. Drill impersonation is enabled and 2. either storage (in remote HiveMetaStore server) or SQL standard based authorization (in Hive storage plugin) is enabled
      Parameters:
      processUserMetaStoreClient - MetaStoreClient of process user. Useful for generating the delegation tokens when SASL (KERBEROS or custom SASL implementations) is enabled.
      hiveConf - Conf including authorization configuration
      userName - User who is trying to access the Hive metadata
      Returns:
      instance of client
    • setTokenStr

      public static void setTokenStr(org.apache.hadoop.security.UserGroupInformation ugi, String tokenStr, String tokenService) throws IOException
      Create a delegation token object for the given token string and service. Add the token to given UGI
      Parameters:
      ugi - user group information
      tokenStr - token string
      tokenService - token service
      Throws:
      IOException - if error happened during decoding token string
    • createCloseableClientWithCaching

      public static DrillHiveMetaStoreClient createCloseableClientWithCaching(org.apache.hadoop.hive.conf.HiveConf hiveConf) throws org.apache.hadoop.hive.metastore.api.MetaException
      Create a DrillMetaStoreClient that can be shared across multiple users. This is created when impersonation is disabled.
      Parameters:
      hiveConf - hive properties set in Drill storage plugin
      Returns:
      instance of client
      Throws:
      org.apache.hadoop.hive.metastore.api.MetaException - when initialization failed