/** * Listen for an event; if it is a DROP_TABLE event, call export_meta_data * */ @Override public void onEvent(PreEventContext context) throws MetaException, NoSuchObjectException, InvalidOperationException { if (context.getEventType() == PreEventType.DROP_TABLE) { export_meta_data((PreDropTableEvent) context); } }
tConfig.set(context.getHandler().getConf()); tAuthenticator.get().setMetaStoreHandler(context.getHandler()); for(HiveMetastoreAuthorizationProvider authorizer : tAuthorizers.get()){ authorizer.setMetaStoreHandler(context.getHandler()); switch (context.getEventType()) { case CREATE_TABLE: authorizeCreateTable((PreCreateTableEvent)context);
public PartitionWrapper(org.apache.hadoop.hive.metastore.api.Partition mapiPart, PreEventContext context) throws HiveException, NoSuchObjectException, MetaException { org.apache.hadoop.hive.metastore.api.Partition wrapperApiPart = mapiPart.deepCopy(); String catName = mapiPart.isSetCatName() ? mapiPart.getCatName() : MetaStoreUtils.getDefaultCatalog(context.getHandler().getConf()); org.apache.hadoop.hive.metastore.api.Table t = context.getHandler().get_table_core( catName, mapiPart.getDbName(), mapiPart.getTableName()); if (wrapperApiPart.getSd() == null){ // In the cases of create partition, by the time this event fires, the partition // object has not yet come into existence, and thus will not yet have a // location or an SD, but these are needed to create a ql.metadata.Partition, // so we use the table's SD. The only place this is used is by the // authorization hooks, so we will not affect code flow in the metastore itself. wrapperApiPart.setSd(t.getSd().deepCopy()); } initialize(new TableWrapper(t),wrapperApiPart); } }
tConfig.set(context.getHandler().getConf()); tAuthenticator.get().setMetaStoreHandler(context.getHandler()); for(HiveMetastoreAuthorizationProvider authorizer : tAuthorizers.get()){ authorizer.setMetaStoreHandler(context.getHandler()); switch (context.getEventType()) { case CREATE_TABLE: authorizeCreateTable((PreCreateTableEvent)context);
public PartitionWrapper(org.apache.hadoop.hive.metastore.api.Partition mapiPart, PreEventContext context) throws HiveException, NoSuchObjectException, MetaException { org.apache.hadoop.hive.metastore.api.Partition wrapperApiPart = mapiPart.deepCopy(); org.apache.hadoop.hive.metastore.api.Table t = context.getHandler().get_table_core( mapiPart.getDbName(), mapiPart.getTableName()); if (wrapperApiPart.getSd() == null){ // In the cases of create partition, by the time this event fires, the partition // object has not yet come into existence, and thus will not yet have a // location or an SD, but these are needed to create a ql.metadata.Partition, // so we use the table's SD. The only place this is used is by the // authorization hooks, so we will not affect code flow in the metastore itself. wrapperApiPart.setSd(t.getSd().deepCopy()); } initialize(new TableWrapper(t),wrapperApiPart); } }
tConfig.set(context.getHandler().getConf()); tAuthenticator.get().setMetaStoreHandler(context.getHandler()); for(HiveMetastoreAuthorizationProvider authorizer : tAuthorizers.get()){ authorizer.setMetaStoreHandler(context.getHandler()); switch (context.getEventType()) { case CREATE_TABLE: authorizeCreateTable((PreCreateTableEvent)context);
/** * Listen for an event; if it is a DROP_TABLE event, call export_meta_data * */ @Override public void onEvent(PreEventContext context) throws MetaException, NoSuchObjectException, InvalidOperationException { if (context.getEventType() == PreEventType.DROP_TABLE) { export_meta_data((PreDropTableEvent) context); } }
public PartitionWrapper(org.apache.hadoop.hive.metastore.api.Partition mapiPart, PreEventContext context) throws HiveException, NoSuchObjectException, MetaException { org.apache.hadoop.hive.metastore.api.Partition wrapperApiPart = mapiPart.deepCopy(); org.apache.hadoop.hive.metastore.api.Table t = context.getHandler().get_table_core( mapiPart.getDbName(), mapiPart.getTableName()); if (wrapperApiPart.getSd() == null){ // In the cases of create partition, by the time this event fires, the partition // object has not yet come into existence, and thus will not yet have a // location or an SD, but these are needed to create a ql.metadata.Partition, // so we use the table's SD. The only place this is used is by the // authorization hooks, so we will not affect code flow in the metastore itself. wrapperApiPart.setSd(t.getSd()); } initialize(new TableWrapper(t),wrapperApiPart); } }
@Override public void onEvent(PreEventContext context) throws MetaException, NoSuchObjectException, InvalidOperationException { Integer cnt = preEvents.get(context.getEventType()); preEvents.put(context.getEventType(), cnt == null ? 1 : cnt + 1); } }
@Override public void onEvent(PreEventContext context) throws MetaException, NoSuchObjectException, InvalidOperationException { switch (context.getEventType()) { case CREATE_TABLE: handle((PreCreateTableEvent) context); break; case ALTER_TABLE: handle((PreAlterTableEvent) context); break; default: //no validation required.. } }
/** * Listen for an event; if it is a DROP_TABLE event, call export_meta_data * */ @Override public void onEvent(PreEventContext context) throws MetaException, NoSuchObjectException, InvalidOperationException { if (context.getEventType() == PreEventType.DROP_TABLE) { export_meta_data((PreDropTableEvent) context); } }
return; switch (context.getEventType()) { case CREATE_TABLE: authorizeCreateTable((PreCreateTableEvent) context);