use of org.apache.hadoop.hive.metastore.messaging.DropConstraintMessage in project hive by apache.
the class DbNotificationListener method onDropConstraint.
/**
* @param dropConstraintEvent drop constraint event
* @throws MetaException
*/
@Override
public void onDropConstraint(DropConstraintEvent dropConstraintEvent) throws MetaException {
String dbName = dropConstraintEvent.getDbName();
String tableName = dropConstraintEvent.getTableName();
String constraintName = dropConstraintEvent.getConstraintName();
DropConstraintMessage msg = MessageBuilder.getInstance().buildDropConstraintMessage(dbName, tableName, constraintName);
NotificationEvent event = new NotificationEvent(0, now(), EventType.DROP_CONSTRAINT.toString(), msgEncoder.getSerializer().serialize(msg));
event.setCatName(dropConstraintEvent.getCatName());
event.setDbName(dbName);
event.setTableName(tableName);
process(event, dropConstraintEvent);
}
use of org.apache.hadoop.hive.metastore.messaging.DropConstraintMessage 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);
}
Aggregations