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;
}
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;
}
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;
}
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;
}
Aggregations