Search in sources :

Example 1 with DefaultHiveMetaHook

use of org.apache.hadoop.hive.metastore.DefaultHiveMetaHook in project hive by apache.

the class DDLTask method preInsertWork.

private int preInsertWork(Hive db, PreInsertTableDesc preInsertTableDesc) throws HiveException {
    try {
        HiveMetaHook hook = preInsertTableDesc.getTable().getStorageHandler().getMetaHook();
        if (hook == null || !(hook instanceof DefaultHiveMetaHook)) {
            return 0;
        }
        DefaultHiveMetaHook hiveMetaHook = (DefaultHiveMetaHook) hook;
        hiveMetaHook.preInsertTable(preInsertTableDesc.getTable().getTTable(), preInsertTableDesc.isOverwrite());
    } catch (MetaException e) {
        throw new HiveException(e);
    }
    return 0;
}
Also used : DefaultHiveMetaHook(org.apache.hadoop.hive.metastore.DefaultHiveMetaHook) HiveMetaHook(org.apache.hadoop.hive.metastore.HiveMetaHook) HiveException(org.apache.hadoop.hive.ql.metadata.HiveException) DefaultHiveMetaHook(org.apache.hadoop.hive.metastore.DefaultHiveMetaHook) MetaException(org.apache.hadoop.hive.metastore.api.MetaException)

Example 2 with DefaultHiveMetaHook

use of org.apache.hadoop.hive.metastore.DefaultHiveMetaHook in project hive by apache.

the class PreInsertTableOperation method execute.

@Override
public int execute() throws HiveException {
    try {
        HiveMetaHook hook = desc.getTable().getStorageHandler().getMetaHook();
        if (hook == null || !(hook instanceof DefaultHiveMetaHook)) {
            return 0;
        }
        DefaultHiveMetaHook hiveMetaHook = (DefaultHiveMetaHook) hook;
        hiveMetaHook.preInsertTable(desc.getTable().getTTable(), desc.isOverwrite());
    } catch (MetaException e) {
        throw new HiveException(e);
    }
    return 0;
}
Also used : HiveMetaHook(org.apache.hadoop.hive.metastore.HiveMetaHook) DefaultHiveMetaHook(org.apache.hadoop.hive.metastore.DefaultHiveMetaHook) HiveException(org.apache.hadoop.hive.ql.metadata.HiveException) DefaultHiveMetaHook(org.apache.hadoop.hive.metastore.DefaultHiveMetaHook) MetaException(org.apache.hadoop.hive.metastore.api.MetaException)

Example 3 with DefaultHiveMetaHook

use of org.apache.hadoop.hive.metastore.DefaultHiveMetaHook in project hive by apache.

the class InsertCommitHookOperation method execute.

@Override
public int execute() throws MetaException {
    HiveMetaHook hook = desc.getTable().getStorageHandler().getMetaHook();
    if (hook == null || !(hook instanceof DefaultHiveMetaHook)) {
        return 0;
    }
    DefaultHiveMetaHook hiveMetaHook = (DefaultHiveMetaHook) hook;
    try {
        hiveMetaHook.commitInsertTable(desc.getTable().getTTable(), desc.isOverwrite());
    } catch (Throwable t) {
        hiveMetaHook.rollbackInsertTable(desc.getTable().getTTable(), desc.isOverwrite());
        throw t;
    }
    return 0;
}
Also used : HiveMetaHook(org.apache.hadoop.hive.metastore.HiveMetaHook) DefaultHiveMetaHook(org.apache.hadoop.hive.metastore.DefaultHiveMetaHook) DefaultHiveMetaHook(org.apache.hadoop.hive.metastore.DefaultHiveMetaHook)

Example 4 with DefaultHiveMetaHook

use of org.apache.hadoop.hive.metastore.DefaultHiveMetaHook in project hive by apache.

the class DDLTask method insertCommitWork.

private int insertCommitWork(Hive db, InsertTableDesc insertTableDesc) throws MetaException {
    boolean failed = true;
    HiveMetaHook hook = insertTableDesc.getTable().getStorageHandler().getMetaHook();
    if (hook == null || !(hook instanceof DefaultHiveMetaHook)) {
        return 0;
    }
    DefaultHiveMetaHook hiveMetaHook = (DefaultHiveMetaHook) hook;
    try {
        hiveMetaHook.commitInsertTable(insertTableDesc.getTable().getTTable(), insertTableDesc.isOverwrite());
        failed = false;
    } finally {
        if (failed) {
            hiveMetaHook.rollbackInsertTable(insertTableDesc.getTable().getTTable(), insertTableDesc.isOverwrite());
        }
    }
    return 0;
}
Also used : DefaultHiveMetaHook(org.apache.hadoop.hive.metastore.DefaultHiveMetaHook) HiveMetaHook(org.apache.hadoop.hive.metastore.HiveMetaHook) DefaultHiveMetaHook(org.apache.hadoop.hive.metastore.DefaultHiveMetaHook)

Aggregations

DefaultHiveMetaHook (org.apache.hadoop.hive.metastore.DefaultHiveMetaHook)4 HiveMetaHook (org.apache.hadoop.hive.metastore.HiveMetaHook)4 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)2 HiveException (org.apache.hadoop.hive.ql.metadata.HiveException)2