Search in sources :

Example 1 with PreAlterDatabaseEvent

use of org.apache.hadoop.hive.metastore.events.PreAlterDatabaseEvent in project hive by apache.

the class AlterDatabaseEvent method getOutputHObjs.

private List<HivePrivilegeObject> getOutputHObjs() {
    LOG.debug("==> AlterDatabaseEvent.getOutputHObjs()");
    List<HivePrivilegeObject> ret = new ArrayList<>();
    PreAlterDatabaseEvent event = (PreAlterDatabaseEvent) preEventContext;
    Database database = event.getNewDatabase();
    if (database != null) {
        ret.add(getHivePrivilegeObject(database));
        String newUri = (database != null) ? database.getLocationUri() : "";
        if (StringUtils.isNotEmpty(newUri)) {
            ret.add(getHivePrivilegeObjectDfsUri(newUri));
        }
        COMMAND_STR = buildCommandString(COMMAND_STR, database);
        LOG.debug("<== AlterDatabaseEvent.getOutputHObjs(): ret={}", ret);
    }
    return ret;
}
Also used : PreAlterDatabaseEvent(org.apache.hadoop.hive.metastore.events.PreAlterDatabaseEvent) ArrayList(java.util.ArrayList) Database(org.apache.hadoop.hive.metastore.api.Database) HivePrivilegeObject(org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObject)

Example 2 with PreAlterDatabaseEvent

use of org.apache.hadoop.hive.metastore.events.PreAlterDatabaseEvent in project hive by apache.

the class AlterDatabaseEvent method getOperationType.

private HiveOperationType getOperationType() {
    PreAlterDatabaseEvent event = (PreAlterDatabaseEvent) preEventContext;
    Database database = event.getNewDatabase();
    Database oldDatabase = event.getOldDatabase();
    String newUri = (database != null) ? database.getLocationUri() : "";
    String oldUri = (oldDatabase != null) ? oldDatabase.getLocationUri() : "";
    return StringUtils.equals(oldUri, newUri) ? HiveOperationType.ALTERDATABASE : HiveOperationType.ALTERDATABASE_LOCATION;
}
Also used : PreAlterDatabaseEvent(org.apache.hadoop.hive.metastore.events.PreAlterDatabaseEvent) Database(org.apache.hadoop.hive.metastore.api.Database)

Aggregations

Database (org.apache.hadoop.hive.metastore.api.Database)2 PreAlterDatabaseEvent (org.apache.hadoop.hive.metastore.events.PreAlterDatabaseEvent)2 ArrayList (java.util.ArrayList)1 HivePrivilegeObject (org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObject)1