Search in sources :

Example 1 with AlterTableDropConstraintDesc

use of org.apache.hadoop.hive.ql.ddl.table.constraint.drop.AlterTableDropConstraintDesc in project hive by apache.

the class DropConstraintHandler method handle.

@Override
public List<Task<?>> handle(Context context) throws SemanticException {
    DropConstraintMessage msg = deserializer.getDropConstraintMessage(context.dmd.getPayload());
    final String actualDbName = context.isDbNameEmpty() ? msg.getDB() : context.dbName;
    final String actualTblName = msg.getTable();
    final TableName tName = HiveTableName.ofNullable(actualTblName, actualDbName);
    String constraintName = msg.getConstraint();
    AlterTableDropConstraintDesc dropConstraintsDesc = new AlterTableDropConstraintDesc(tName, context.eventOnlyReplicationSpec(), constraintName);
    Task<DDLWork> dropConstraintsTask = TaskFactory.get(new DDLWork(readEntitySet, writeEntitySet, dropConstraintsDesc, true, context.getDumpDirectory(), context.getMetricCollector()), context.hiveConf);
    context.log.debug("Added drop constrain task : {}:{}", dropConstraintsTask.getId(), actualTblName);
    updatedMetadata.set(context.dmd.getEventTo().toString(), actualDbName, actualTblName, null);
    return Collections.singletonList(dropConstraintsTask);
}
Also used : HiveTableName(org.apache.hadoop.hive.ql.parse.HiveTableName) TableName(org.apache.hadoop.hive.common.TableName) AlterTableDropConstraintDesc(org.apache.hadoop.hive.ql.ddl.table.constraint.drop.AlterTableDropConstraintDesc) DropConstraintMessage(org.apache.hadoop.hive.metastore.messaging.DropConstraintMessage) DDLWork(org.apache.hadoop.hive.ql.ddl.DDLWork)

Aggregations

TableName (org.apache.hadoop.hive.common.TableName)1 DropConstraintMessage (org.apache.hadoop.hive.metastore.messaging.DropConstraintMessage)1 DDLWork (org.apache.hadoop.hive.ql.ddl.DDLWork)1 AlterTableDropConstraintDesc (org.apache.hadoop.hive.ql.ddl.table.constraint.drop.AlterTableDropConstraintDesc)1 HiveTableName (org.apache.hadoop.hive.ql.parse.HiveTableName)1