use of org.apache.hadoop.hive.ql.processors.CommandProcessorResponse in project hive by apache.
the class TestSemanticAnalysis method testAlterTblTouch.
@Test
public void testAlterTblTouch() throws Exception {
hcatDriver.run("drop table junit_sem_analysis");
hcatDriver.run("create table junit_sem_analysis (a int) partitioned by (b string) stored as RCFILE");
CommandProcessorResponse response = hcatDriver.run("alter table junit_sem_analysis touch");
assertEquals(0, response.getResponseCode());
hcatDriver.run("alter table junit_sem_analysis touch partition (b='12')");
assertEquals(0, response.getResponseCode());
hcatDriver.run("drop table junit_sem_analysis");
}
use of org.apache.hadoop.hive.ql.processors.CommandProcessorResponse in project hive by apache.
the class TestSemanticAnalysis method testCreateTableIfNotExists.
@Test
public void testCreateTableIfNotExists() throws Exception {
hcatDriver.run("drop table " + TBL_NAME);
hcatDriver.run("create table " + TBL_NAME + " (a int) stored as RCFILE");
Table tbl = client.getTable(Warehouse.DEFAULT_DATABASE_NAME, TBL_NAME);
List<FieldSchema> cols = tbl.getSd().getCols();
assertEquals(1, cols.size());
assertTrue(cols.get(0).equals(new FieldSchema("a", "int", null)));
assertEquals(RCFileInputFormat.class.getName(), tbl.getSd().getInputFormat());
assertEquals(RCFileOutputFormat.class.getName(), tbl.getSd().getOutputFormat());
CommandProcessorResponse resp = hcatDriver.run("create table if not exists junit_sem_analysis (a int) stored as RCFILE");
assertEquals(0, resp.getResponseCode());
assertNull(resp.getErrorMessage());
tbl = client.getTable(Warehouse.DEFAULT_DATABASE_NAME, TBL_NAME);
cols = tbl.getSd().getCols();
assertEquals(1, cols.size());
assertTrue(cols.get(0).equals(new FieldSchema("a", "int", null)));
assertEquals(RCFileInputFormat.class.getName(), tbl.getSd().getInputFormat());
assertEquals(RCFileOutputFormat.class.getName(), tbl.getSd().getOutputFormat());
hcatDriver.run("drop table junit_sem_analysis");
}
use of org.apache.hadoop.hive.ql.processors.CommandProcessorResponse in project hive by apache.
the class TestSemanticAnalysis method testInvalidateClusteredBy.
@Test
public void testInvalidateClusteredBy() throws Exception {
hcatDriver.run("drop table junit_sem_analysis");
query = "create table junit_sem_analysis (a int) partitioned by (b string) clustered by (a) into 10 buckets stored as TEXTFILE";
CommandProcessorResponse response = hcatDriver.run(query);
assertEquals(0, response.getResponseCode());
}
use of org.apache.hadoop.hive.ql.processors.CommandProcessorResponse in project hive by apache.
the class TestSemanticAnalysis method testAlterTblClusteredBy.
@Test
public void testAlterTblClusteredBy() throws Exception {
hcatDriver.run("drop table junit_sem_analysis");
hcatDriver.run("create table junit_sem_analysis (a int) partitioned by (b string) stored as RCFILE");
CommandProcessorResponse response = hcatDriver.run("alter table junit_sem_analysis clustered by (a) into 7 buckets");
assertEquals(0, response.getResponseCode());
hcatDriver.run("drop table junit_sem_analysis");
}
use of org.apache.hadoop.hive.ql.processors.CommandProcessorResponse in project hive by apache.
the class TestSemanticAnalysis method testInvalidateTextFileStoredAs.
@Test
public void testInvalidateTextFileStoredAs() throws Exception {
hcatDriver.run("drop table junit_sem_analysis");
query = "create table junit_sem_analysis (a int) partitioned by (b string) stored as TEXTFILE";
CommandProcessorResponse response = hcatDriver.run(query);
assertEquals(0, response.getResponseCode());
}
Aggregations