Search in sources :

Example 26 with CliSessionState

use of org.apache.hadoop.hive.cli.CliSessionState in project hive by apache.

the class TestSemanticAnalysis method setUpHCatDriver.

@Before
public void setUpHCatDriver() throws IOException {
    if (hcatDriver == null) {
        HiveConf hcatConf = new HiveConf(hiveConf);
        hcatConf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, "org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory");
        hcatConf.set(HiveConf.ConfVars.HIVEDEFAULTRCFILESERDE.varname, "org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe");
        hcatConf.set(HiveConf.ConfVars.SEMANTIC_ANALYZER_HOOK.varname, HCatSemanticAnalyzer.class.getName());
        hcatConf.setBoolVar(HiveConf.ConfVars.METASTORE_DISALLOW_INCOMPATIBLE_COL_TYPE_CHANGES, false);
        hcatDriver = DriverFactory.newDriver(hcatConf);
        SessionState.start(new CliSessionState(hcatConf));
    }
}
Also used : HCatSemanticAnalyzer(org.apache.hive.hcatalog.cli.SemanticAnalysis.HCatSemanticAnalyzer) HiveConf(org.apache.hadoop.hive.conf.HiveConf) CliSessionState(org.apache.hadoop.hive.cli.CliSessionState) Before(org.junit.Before)

Example 27 with CliSessionState

use of org.apache.hadoop.hive.cli.CliSessionState in project hive by apache.

the class TestUseDatabase method setUp.

@Override
protected void setUp() throws Exception {
    HiveConf hcatConf = new HiveConf(this.getClass());
    hcatConf.set(ConfVars.PREEXECHOOKS.varname, "");
    hcatConf.set(ConfVars.POSTEXECHOOKS.varname, "");
    hcatConf.set(ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
    hcatConf.set(ConfVars.SEMANTIC_ANALYZER_HOOK.varname, HCatSemanticAnalyzer.class.getName());
    hcatDriver = DriverFactory.newDriver(hcatConf);
    SessionState.start(new CliSessionState(hcatConf));
}
Also used : HCatSemanticAnalyzer(org.apache.hive.hcatalog.cli.SemanticAnalysis.HCatSemanticAnalyzer) HiveConf(org.apache.hadoop.hive.conf.HiveConf) CliSessionState(org.apache.hadoop.hive.cli.CliSessionState)

Example 28 with CliSessionState

use of org.apache.hadoop.hive.cli.CliSessionState 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)

Example 29 with CliSessionState

use of org.apache.hadoop.hive.cli.CliSessionState in project hive by apache.

the class TestPassProperties method Initialize.

public void Initialize() throws Exception {
    hiveConf = new HiveConf(this.getClass());
    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.METASTOREWAREHOUSE.varname, TEST_WAREHOUSE_DIR);
    hiveConf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, "org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory");
    driver = DriverFactory.newDriver(hiveConf);
    SessionState.start(new CliSessionState(hiveConf));
    new File(TEST_WAREHOUSE_DIR).mkdirs();
    int numRows = 3;
    input = new String[numRows];
    for (int i = 0; i < numRows; i++) {
        String col1 = "a" + i;
        String col2 = "b" + i;
        input[i] = i + "," + col1 + "," + col2;
    }
    HcatTestUtils.createTestDataFile(INPUT_FILE_NAME, input);
    server = new PigServer(ExecType.LOCAL);
}
Also used : PigServer(org.apache.pig.PigServer) HiveConf(org.apache.hadoop.hive.conf.HiveConf) CliSessionState(org.apache.hadoop.hive.cli.CliSessionState) File(java.io.File)

Example 30 with CliSessionState

use of org.apache.hadoop.hive.cli.CliSessionState in project hive by apache.

the class TestHCatLoaderComplexSchema method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    HiveConf hiveConf = new HiveConf(TestHCatLoaderComplexSchema.class);
    hiveConf.set(HiveConf.ConfVars.PREEXECHOOKS.varname, "");
    hiveConf.set(HiveConf.ConfVars.POSTEXECHOOKS.varname, "");
    hiveConf.set(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
    hiveConf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, "org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory");
    driver = DriverFactory.newDriver(hiveConf);
    SessionState.start(new CliSessionState(hiveConf));
// props = new Properties();
// props.setProperty("fs.default.name", cluster.getProperties().getProperty("fs.default.name"));
}
Also used : HiveConf(org.apache.hadoop.hive.conf.HiveConf) CliSessionState(org.apache.hadoop.hive.cli.CliSessionState) BeforeClass(org.junit.BeforeClass)

Aggregations

CliSessionState (org.apache.hadoop.hive.cli.CliSessionState)58 HiveConf (org.apache.hadoop.hive.conf.HiveConf)44 File (java.io.File)12 HiveMetaStoreClient (org.apache.hadoop.hive.metastore.HiveMetaStoreClient)12 Before (org.junit.Before)12 SessionState (org.apache.hadoop.hive.ql.session.SessionState)11 BeforeClass (org.junit.BeforeClass)9 Path (org.apache.hadoop.fs.Path)8 Driver (org.apache.hadoop.hive.ql.Driver)8 PrintStream (java.io.PrintStream)7 UnsupportedEncodingException (java.io.UnsupportedEncodingException)6 LogInitializationException (org.apache.hadoop.hive.common.LogUtils.LogInitializationException)6 Map (java.util.Map)5 CliDriver (org.apache.hadoop.hive.cli.CliDriver)5 CachingPrintStream (org.apache.hadoop.hive.common.io.CachingPrintStream)5 FileNotFoundException (java.io.FileNotFoundException)4 FileSystem (org.apache.hadoop.fs.FileSystem)4 AuthorizationPreEventListener (org.apache.hadoop.hive.ql.security.authorization.AuthorizationPreEventListener)4 BufferedOutputStream (java.io.BufferedOutputStream)3 FileOutputStream (java.io.FileOutputStream)3