use of org.apache.hadoop.hive.ql.ddl.table.storage.compact.AlterTableCompactDesc in project hive by apache.
the class AlterTableConcatenateAnalyzer method compactAcidTable.
private void compactAcidTable(TableName tableName, Map<String, String> partitionSpec) throws SemanticException {
boolean isBlocking = !HiveConf.getBoolVar(conf, ConfVars.TRANSACTIONAL_CONCATENATE_NOBLOCK, false);
AlterTableCompactDesc desc = new AlterTableCompactDesc(tableName, partitionSpec, "MAJOR", isBlocking, null);
rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), desc)));
setAcidDdlDesc(getTable(tableName), desc);
}
use of org.apache.hadoop.hive.ql.ddl.table.storage.compact.AlterTableCompactDesc in project hive by apache.
the class TestQBCompact method parseAndAnalyzeAlterTable.
private AlterTableCompactDesc parseAndAnalyzeAlterTable(String query) throws Exception {
ParseDriver hd = new ParseDriver();
ASTNode head = (ASTNode) hd.parse(query).getTree().getChild(0);
BaseSemanticAnalyzer a = SemanticAnalyzerFactory.get(queryState, head);
a.analyze(head, new Context(conf));
List<Task<?>> roots = a.getRootTasks();
Assert.assertEquals(1, roots.size());
return (AlterTableCompactDesc) ((DDLWork) roots.get(0).getWork()).getDDLDesc();
}
use of org.apache.hadoop.hive.ql.ddl.table.storage.compact.AlterTableCompactDesc in project hive by apache.
the class TestQBCompact method testMajor.
@Test
public void testMajor() throws Exception {
AlterTableCompactDesc desc = parseAndAnalyzeAlterTable("alter table foo partition(ds = 'today') compact 'major'");
Assert.assertEquals("major", desc.getCompactionType());
Assert.assertEquals("default.foo", desc.getTableName());
Map<String, String> parts = desc.getPartitionSpec();
Assert.assertEquals(1, parts.size());
Assert.assertEquals("today", parts.get("ds"));
}
use of org.apache.hadoop.hive.ql.ddl.table.storage.compact.AlterTableCompactDesc in project hive by apache.
the class TestQBCompact method testMinor.
@Test
public void testMinor() throws Exception {
AlterTableCompactDesc desc = parseAndAnalyzeAlterTable("alter table foo partition(ds = 'today') compact 'minor'");
Assert.assertEquals("minor", desc.getCompactionType());
Assert.assertEquals("default.foo", desc.getTableName());
Map<String, String> parts = desc.getPartitionSpec();
Assert.assertEquals(1, parts.size());
Assert.assertEquals("today", parts.get("ds"));
}
use of org.apache.hadoop.hive.ql.ddl.table.storage.compact.AlterTableCompactDesc in project hive by apache.
the class TestQBCompact method testNonPartitionedTable.
@Test
public void testNonPartitionedTable() throws Exception {
AlterTableCompactDesc desc = parseAndAnalyzeAlterTable("alter table foo compact 'major'");
Assert.assertEquals("major", desc.getCompactionType());
Assert.assertEquals("default.foo", desc.getTableName());
}
Aggregations