org.apache.hadoop.hive.ql.hooks.HookContext Java Examples
The following examples show how to use
org.apache.hadoop.hive.ql.hooks.HookContext.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HiveHook.java From atlas with Apache License 2.0 | 6 votes |
@Override public void run(final HookContext hookContext) throws Exception { if (LOG.isDebugEnabled()) { LOG.debug("==> HiveHook.run({})", hookContext); } try { activatePluginClassLoader(); hiveHookImpl.run(hookContext); } finally { deactivatePluginClassLoader(); } if (LOG.isDebugEnabled()) { LOG.debug("<== HiveHook.run({})", hookContext); } }
Example #2
Source File: HiveHook.java From incubator-atlas with Apache License 2.0 | 6 votes |
@Override public void run(final HookContext hookContext) throws Exception { if (LOG.isDebugEnabled()) { LOG.debug("==> HiveHook.run({})", hookContext); } try { activatePluginClassLoader(); hiveHookImpl.run(hookContext); } finally { deactivatePluginClassLoader(); } if (LOG.isDebugEnabled()) { LOG.debug("<== HiveHook.run({})", hookContext); } }
Example #3
Source File: HiveHook.java From atlas with Apache License 2.0 | 4 votes |
@Override public void run(HookContext hookContext) throws Exception { if (LOG.isDebugEnabled()) { LOG.debug("==> HiveHook.run({})", hookContext.getOperationName()); } try { HiveOperation oper = OPERATION_MAP.get(hookContext.getOperationName()); AtlasHiveHookContext context = new AtlasHiveHookContext(this, oper, hookContext, getKnownObjects()); BaseHiveEvent event = null; switch (oper) { case CREATEDATABASE: event = new CreateDatabase(context); break; case DROPDATABASE: event = new DropDatabase(context); break; case ALTERDATABASE: case ALTERDATABASE_OWNER: case ALTERDATABASE_LOCATION: event = new AlterDatabase(context); break; case CREATETABLE: event = new CreateTable(context, true); break; case DROPTABLE: case DROPVIEW: event = new DropTable(context); break; case CREATETABLE_AS_SELECT: case CREATEVIEW: case ALTERVIEW_AS: case LOAD: case EXPORT: case IMPORT: case QUERY: event = new CreateHiveProcess(context, true); break; case ALTERTABLE_FILEFORMAT: case ALTERTABLE_CLUSTER_SORT: case ALTERTABLE_BUCKETNUM: case ALTERTABLE_PROPERTIES: case ALTERVIEW_PROPERTIES: case ALTERTABLE_SERDEPROPERTIES: case ALTERTABLE_SERIALIZER: case ALTERTABLE_ADDCOLS: case ALTERTABLE_REPLACECOLS: case ALTERTABLE_PARTCOLTYPE: case ALTERTABLE_LOCATION: event = new AlterTable(context); break; case ALTERTABLE_RENAME: case ALTERVIEW_RENAME: event = new AlterTableRename(context); break; case ALTERTABLE_RENAMECOL: event = new AlterTableRenameCol(context); break; default: if (LOG.isDebugEnabled()) { LOG.debug("HiveHook.run({}): operation ignored", hookContext.getOperationName()); } break; } if (event != null) { final UserGroupInformation ugi = hookContext.getUgi() == null ? Utils.getUGI() : hookContext.getUgi(); super.notifyEntities(event.getNotificationMessages(), ugi); } } catch (Throwable t) { LOG.error("HiveHook.run(): failed to process operation {}", hookContext.getOperationName(), t); } if (LOG.isDebugEnabled()) { LOG.debug("<== HiveHook.run({})", hookContext.getOperationName()); } }
Example #4
Source File: HiveITBase.java From atlas with Apache License 2.0 | 4 votes |
public void setHookType(HookContext.HookType hookType) { this.hookType = hookType; }
Example #5
Source File: HiveITBase.java From atlas with Apache License 2.0 | 4 votes |
public HookContext.HookType getHookType() { return hookType; }
Example #6
Source File: HiveHook.java From incubator-atlas with Apache License 2.0 | 4 votes |
@Override public void run(final HookContext hookContext) throws Exception { // clone to avoid concurrent access try { final HiveEventContext event = new HiveEventContext(); event.setInputs(hookContext.getInputs()); event.setOutputs(hookContext.getOutputs()); event.setHookType(hookContext.getHookType()); final UserGroupInformation ugi = hookContext.getUgi() == null ? Utils.getUGI() : hookContext.getUgi(); event.setUgi(ugi); event.setUser(getUser(hookContext.getUserName(), hookContext.getUgi())); event.setOperation(OPERATION_MAP.get(hookContext.getOperationName())); event.setQueryId(hookContext.getQueryPlan().getQueryId()); event.setQueryStr(hookContext.getQueryPlan().getQueryStr()); event.setQueryStartTime(hookContext.getQueryPlan().getQueryStartTime()); event.setQueryType(hookContext.getQueryPlan().getQueryPlan().getQueryType()); event.setLineageInfo(hookContext.getLinfo()); if (executor == null) { collect(event); notifyAsPrivilegedAction(event); } else { executor.submit(new Runnable() { @Override public void run() { try { ugi.doAs(new PrivilegedExceptionAction<Object>() { @Override public Object run() throws Exception { collect(event); return event; } }); notifyAsPrivilegedAction(event); } catch (Throwable e) { LOG.error("Atlas hook failed due to error ", e); } } }); } } catch (Throwable t) { LOG.error("Submitting to thread pool failed due to error ", t); } }
Example #7
Source File: HiveHook.java From incubator-atlas with Apache License 2.0 | 4 votes |
public void setHookType(HookContext.HookType hookType) { this.hookType = hookType; }
Example #8
Source File: HiveHook.java From incubator-atlas with Apache License 2.0 | 4 votes |
public HookContext.HookType getHookType() { return hookType; }
Example #9
Source File: PostExecHook.java From spliceengine with GNU Affero General Public License v3.0 | 4 votes |
@Override public void run(HookContext hookContext) throws Exception { // TODO Auto-generated method stub SMStorageHandler.commitParentTxn(); Log.info("job committed"); }
Example #10
Source File: FailureExecHook.java From spliceengine with GNU Affero General Public License v3.0 | 4 votes |
@Override public void run(HookContext hookContext) throws Exception { LOG.info("failure in job, rolled back"); SMStorageHandler.rollbackParentTxn(); }