Search in sources :

Example 16 with HiveMetaStoreClient

use of org.apache.hadoop.hive.metastore.HiveMetaStoreClient in project hive by apache.

the class TestAuthorizationPreEventListener method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    System.setProperty(HiveConf.ConfVars.METASTORE_PRE_EVENT_LISTENERS.varname, AuthorizationPreEventListener.class.getName());
    System.setProperty(HiveConf.ConfVars.HIVE_METASTORE_AUTHORIZATION_MANAGER.varname, DummyHiveMetastoreAuthorizationProvider.class.getName());
    System.setProperty(HiveConf.ConfVars.HIVE_METASTORE_AUTHENTICATOR_MANAGER.varname, HadoopDefaultMetastoreAuthenticator.class.getName());
    int port = MetaStoreTestUtils.startMetaStoreWithRetry();
    clientHiveConf = new HiveConf(this.getClass());
    clientHiveConf.setVar(HiveConf.ConfVars.METASTOREURIS, "thrift://localhost:" + port);
    clientHiveConf.setIntVar(HiveConf.ConfVars.METASTORETHRIFTCONNECTIONRETRIES, 3);
    clientHiveConf.set(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
    clientHiveConf.set(HiveConf.ConfVars.PREEXECHOOKS.varname, "");
    clientHiveConf.set(HiveConf.ConfVars.POSTEXECHOOKS.varname, "");
    SessionState.start(new CliSessionState(clientHiveConf));
    msc = new HiveMetaStoreClient(clientHiveConf);
    driver = DriverFactory.newDriver(clientHiveConf);
}
Also used : HiveMetaStoreClient(org.apache.hadoop.hive.metastore.HiveMetaStoreClient) HiveConf(org.apache.hadoop.hive.conf.HiveConf) AuthorizationPreEventListener(org.apache.hadoop.hive.ql.security.authorization.AuthorizationPreEventListener) CliSessionState(org.apache.hadoop.hive.cli.CliSessionState)

Example 17 with HiveMetaStoreClient

use of org.apache.hadoop.hive.metastore.HiveMetaStoreClient in project hive by apache.

the class TestClientSideAuthorizationProvider method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    // Turn off metastore-side authorization
    System.setProperty(HiveConf.ConfVars.METASTORE_PRE_EVENT_LISTENERS.varname, "");
    int port = MetaStoreTestUtils.startMetaStoreWithRetry();
    clientHiveConf = new HiveConf(this.getClass());
    // Turn on client-side authorization
    clientHiveConf.setBoolVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_ENABLED, true);
    clientHiveConf.set(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER.varname, getAuthorizationProvider());
    clientHiveConf.set(HiveConf.ConfVars.HIVE_AUTHENTICATOR_MANAGER.varname, InjectableDummyAuthenticator.class.getName());
    clientHiveConf.set(HiveConf.ConfVars.HIVE_AUTHORIZATION_TABLE_OWNER_GRANTS.varname, "");
    clientHiveConf.setVar(HiveConf.ConfVars.HIVEMAPREDMODE, "nonstrict");
    clientHiveConf.setVar(HiveConf.ConfVars.METASTOREURIS, "thrift://localhost:" + port);
    clientHiveConf.setIntVar(HiveConf.ConfVars.METASTORETHRIFTCONNECTIONRETRIES, 3);
    clientHiveConf.set(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
    clientHiveConf.set(HiveConf.ConfVars.PREEXECHOOKS.varname, "");
    clientHiveConf.set(HiveConf.ConfVars.POSTEXECHOOKS.varname, "");
    ugi = Utils.getUGI();
    SessionState.start(new CliSessionState(clientHiveConf));
    msc = new HiveMetaStoreClient(clientHiveConf);
    driver = DriverFactory.newDriver(clientHiveConf);
}
Also used : HiveMetaStoreClient(org.apache.hadoop.hive.metastore.HiveMetaStoreClient) HiveConf(org.apache.hadoop.hive.conf.HiveConf) CliSessionState(org.apache.hadoop.hive.cli.CliSessionState)

Example 18 with HiveMetaStoreClient

use of org.apache.hadoop.hive.metastore.HiveMetaStoreClient in project hive by apache.

the class ManyMiniCluster method setUpMetastore.

private void setUpMetastore() throws Exception {
    if (hiveConf == null)
        hiveConf = new HiveConf(this.getClass());
    // The default org.apache.hadoop.hive.ql.hooks.PreExecutePrinter hook
    // is present only in the ql/test directory
    hiveConf.set(HiveConf.ConfVars.PREEXECHOOKS.varname, "");
    hiveConf.set(HiveConf.ConfVars.POSTEXECHOOKS.varname, "");
    hiveConf.set(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
    hiveConf.set(HiveConf.ConfVars.METASTORECONNECTURLKEY.varname, "jdbc:derby:" + new File(workDir + "/metastore_db") + ";create=true");
    hiveConf.set(HiveConf.ConfVars.METASTOREWAREHOUSE.toString(), new File(workDir, "warehouse").toString());
    // set where derby logs
    File derbyLogFile = new File(workDir + "/derby.log");
    derbyLogFile.createNewFile();
    System.setProperty("derby.stream.error.file", derbyLogFile.getPath());
    // Driver driver = new Driver(conf);
    // SessionState.start(new CliSessionState(conf));
    hiveMetaStoreClient = new HiveMetaStoreClient(hiveConf);
}
Also used : HiveMetaStoreClient(org.apache.hadoop.hive.metastore.HiveMetaStoreClient) HiveConf(org.apache.hadoop.hive.conf.HiveConf) File(java.io.File)

Example 19 with HiveMetaStoreClient

use of org.apache.hadoop.hive.metastore.HiveMetaStoreClient in project hive by apache.

the class TestPermsGrp method setUp.

@Override
protected void setUp() throws Exception {
    if (isServerRunning) {
        return;
    }
    msPort = MetaStoreTestUtils.startMetaStoreWithRetry();
    isServerRunning = true;
    securityManager = System.getSecurityManager();
    System.setSecurityManager(new NoExitSecurityManager());
    Policy.setPolicy(new DerbyPolicy());
    hcatConf = new HiveConf(this.getClass());
    hcatConf.setVar(HiveConf.ConfVars.METASTOREURIS, "thrift://127.0.0.1:" + msPort);
    hcatConf.setIntVar(HiveConf.ConfVars.METASTORETHRIFTCONNECTIONRETRIES, 3);
    hcatConf.setIntVar(HiveConf.ConfVars.METASTORETHRIFTFAILURERETRIES, 3);
    hcatConf.set(HiveConf.ConfVars.SEMANTIC_ANALYZER_HOOK.varname, HCatSemanticAnalyzer.class.getName());
    hcatConf.set(HiveConf.ConfVars.PREEXECHOOKS.varname, "");
    hcatConf.set(HiveConf.ConfVars.POSTEXECHOOKS.varname, "");
    hcatConf.setTimeVar(HiveConf.ConfVars.METASTORE_CLIENT_SOCKET_TIMEOUT, 60, TimeUnit.SECONDS);
    hcatConf.setBoolVar(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
    clientWH = new Warehouse(hcatConf);
    msc = new HiveMetaStoreClient(hcatConf);
    System.setProperty(HiveConf.ConfVars.PREEXECHOOKS.varname, " ");
    System.setProperty(HiveConf.ConfVars.POSTEXECHOOKS.varname, " ");
}
Also used : DerbyPolicy(org.apache.hive.hcatalog.DerbyPolicy) Warehouse(org.apache.hadoop.hive.metastore.Warehouse) HiveMetaStoreClient(org.apache.hadoop.hive.metastore.HiveMetaStoreClient) HCatSemanticAnalyzer(org.apache.hive.hcatalog.cli.SemanticAnalysis.HCatSemanticAnalyzer) HiveConf(org.apache.hadoop.hive.conf.HiveConf) NoExitSecurityManager(org.apache.hive.hcatalog.NoExitSecurityManager)

Example 20 with HiveMetaStoreClient

use of org.apache.hadoop.hive.metastore.HiveMetaStoreClient in project hive by apache.

the class HCatBaseTest method setUp.

@Before
public void setUp() throws Exception {
    if (driver == null) {
        setUpHiveConf();
        driver = DriverFactory.newDriver(hiveConf);
        client = new HiveMetaStoreClient(hiveConf);
        SessionState.start(new CliSessionState(hiveConf));
    }
}
Also used : HiveMetaStoreClient(org.apache.hadoop.hive.metastore.HiveMetaStoreClient) CliSessionState(org.apache.hadoop.hive.cli.CliSessionState) Before(org.junit.Before)

Aggregations

HiveMetaStoreClient (org.apache.hadoop.hive.metastore.HiveMetaStoreClient)45 HiveConf (org.apache.hadoop.hive.conf.HiveConf)20 Path (org.apache.hadoop.fs.Path)14 Table (org.apache.hadoop.hive.metastore.api.Table)14 CliSessionState (org.apache.hadoop.hive.cli.CliSessionState)12 FileSystem (org.apache.hadoop.fs.FileSystem)11 IMetaStoreClient (org.apache.hadoop.hive.metastore.IMetaStoreClient)11 HiveEndPoint (org.apache.hive.hcatalog.streaming.HiveEndPoint)9 Test (org.junit.Test)9 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)8 FileStatus (org.apache.hadoop.fs.FileStatus)8 CompactionRequest (org.apache.hadoop.hive.metastore.api.CompactionRequest)8 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)8 TxnStore (org.apache.hadoop.hive.metastore.txn.TxnStore)8 File (java.io.File)7 WindowingException (com.sap.hadoop.windowing.WindowingException)6 DelimitedInputWriter (org.apache.hive.hcatalog.streaming.DelimitedInputWriter)6 StreamingConnection (org.apache.hive.hcatalog.streaming.StreamingConnection)6 Before (org.junit.Before)6 BeforeClass (org.junit.BeforeClass)5