Search in sources :

Example 1 with QueryState

use of org.apache.hadoop.hive.ql.QueryState in project hive by apache.

the class TestPrivilegesV2 method setup.

@Before
public void setup() throws Exception {
    queryState = new QueryState(null);
    //set authorization mode to V2
    HiveConf conf = queryState.getConf();
    conf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, SQLStdHiveAuthorizerFactory.class.getName());
    db = Mockito.mock(Hive.class);
    table = new Table(DB, TABLE);
    SessionState.start(conf);
    Mockito.when(db.getTable(DB, TABLE, false)).thenReturn(table);
    Mockito.when(db.getTable(TABLE_QNAME, false)).thenReturn(table);
    Mockito.when(db.getPartition(table, new HashMap<String, String>(), false)).thenReturn(partition);
}
Also used : Hive(org.apache.hadoop.hive.ql.metadata.Hive) Table(org.apache.hadoop.hive.ql.metadata.Table) SQLStdHiveAuthorizerFactory(org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory) HiveConf(org.apache.hadoop.hive.conf.HiveConf) QueryState(org.apache.hadoop.hive.ql.QueryState) Before(org.junit.Before)

Example 2 with QueryState

use of org.apache.hadoop.hive.ql.QueryState in project hive by apache.

the class TestMacroSemanticAnalyzer method setup.

@Before
public void setup() throws Exception {
    queryState = new QueryState(null);
    conf = queryState.getConf();
    SessionState.start(conf);
    context = new Context(conf);
    analyzer = new MacroSemanticAnalyzer(queryState);
}
Also used : Context(org.apache.hadoop.hive.ql.Context) QueryState(org.apache.hadoop.hive.ql.QueryState) Before(org.junit.Before)

Example 3 with QueryState

use of org.apache.hadoop.hive.ql.QueryState in project hive by apache.

the class TestQBCompact method init.

@BeforeClass
public static void init() throws Exception {
    queryState = new QueryState(null);
    conf = queryState.getConf();
    conf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, "org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory");
    SessionState.start(conf);
    // Create a table so we can work against it
    Hive h = Hive.get(conf);
    List<String> cols = new ArrayList<String>();
    cols.add("a");
    List<String> partCols = new ArrayList<String>();
    partCols.add("ds");
    h.createTable("foo", cols, partCols, OrcInputFormat.class, OrcOutputFormat.class);
    Table t = h.getTable("foo");
    Map<String, String> partSpec = new HashMap<String, String>();
    partSpec.put("ds", "today");
    h.createPartition(t, partSpec);
}
Also used : Hive(org.apache.hadoop.hive.ql.metadata.Hive) Table(org.apache.hadoop.hive.ql.metadata.Table) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) QueryState(org.apache.hadoop.hive.ql.QueryState) BeforeClass(org.junit.BeforeClass)

Example 4 with QueryState

use of org.apache.hadoop.hive.ql.QueryState in project hive by apache.

the class TestQBJoinTreeApplyPredicate method initialize.

@BeforeClass
public static void initialize() {
    queryState = new QueryState(new HiveConf(SemanticAnalyzer.class));
    conf = queryState.getConf();
    SessionState.start(conf);
}
Also used : HiveConf(org.apache.hadoop.hive.conf.HiveConf) QueryState(org.apache.hadoop.hive.ql.QueryState) BeforeClass(org.junit.BeforeClass)

Example 5 with QueryState

use of org.apache.hadoop.hive.ql.QueryState in project hive by apache.

the class TestQBSubQuery method initialize.

@BeforeClass
public static void initialize() {
    queryState = new QueryState(new HiveConf(SemanticAnalyzer.class));
    conf = queryState.getConf();
    SessionState.start(conf);
}
Also used : HiveConf(org.apache.hadoop.hive.conf.HiveConf) QueryState(org.apache.hadoop.hive.ql.QueryState) BeforeClass(org.junit.BeforeClass)

Aggregations

QueryState (org.apache.hadoop.hive.ql.QueryState)16 HiveConf (org.apache.hadoop.hive.conf.HiveConf)9 Hive (org.apache.hadoop.hive.ql.metadata.Hive)6 Before (org.junit.Before)6 Table (org.apache.hadoop.hive.ql.metadata.Table)5 ArrayList (java.util.ArrayList)4 Context (org.apache.hadoop.hive.ql.Context)4 BeforeClass (org.junit.BeforeClass)4 Partition (org.apache.hadoop.hive.ql.metadata.Partition)3 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 Path (org.apache.hadoop.fs.Path)2 CompilationOpContext (org.apache.hadoop.hive.ql.CompilationOpContext)2 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 FileStatus (org.apache.hadoop.fs.FileStatus)1 FileSystem (org.apache.hadoop.fs.FileSystem)1 FetchConverter (org.apache.hadoop.hive.common.io.FetchConverter)1 DriverContext (org.apache.hadoop.hive.ql.DriverContext)1 QueryPlan (org.apache.hadoop.hive.ql.QueryPlan)1