firePreEvent(new PreDropPartitionEvent(tbl, part, deleteData, this)); if (colNames != null) { partNames.add(FileUtils.makePartName(colNames, part.getValues()));
private void authorizeDropMultiPartition(HiveMultiPartitionAuthorizationProviderBase authorizer, final PreDropPartitionEvent context) throws AuthorizationException, HiveException { Iterator<Partition> partitionIterator = context.getPartitionIterator(); final TableWrapper table = new TableWrapper(context.getTable()); final Iterator<org.apache.hadoop.hive.ql.metadata.Partition> qlPartitionIterator = Iterators.transform(partitionIterator, new Function<Partition, org.apache.hadoop.hive.ql.metadata.Partition>() { @Override public org.apache.hadoop.hive.ql.metadata.Partition apply(Partition partition) { try { return new PartitionWrapper(table, partition); } catch (Exception exception) { LOG.error("Could not construct partition-object for: " + partition, exception); throw new RuntimeException(exception); } } }); authorizer.authorize(new TableWrapper(context.getTable()), new Iterable<org.apache.hadoop.hive.ql.metadata.Partition>() { @Override public Iterator<org.apache.hadoop.hive.ql.metadata.Partition> iterator() { return qlPartitionIterator; } }, HiveOperation.ALTERTABLE_DROPPARTS.getInputRequiredPrivileges(), HiveOperation.ALTERTABLE_DROPPARTS.getOutputRequiredPrivileges()); }
protected void authorizeDropPartition(PreDropPartitionEvent context) throws InvalidOperationException, MetaException { authorizeMetastoreAccess( HiveOperation.ALTERTABLE_DROPPARTS, new HierarcyBuilder().addTableToOutput(getAuthServer(), context.getPartition().getDbName(), context.getPartition().getTableName()).build(), new HierarcyBuilder().addTableToOutput(getAuthServer(), context.getPartition().getDbName(), context.getPartition().getTableName()).build()); }
private void authorizeDropMultiPartition(HiveMultiPartitionAuthorizationProviderBase authorizer, final PreDropPartitionEvent context) throws AuthorizationException, HiveException { Iterator<Partition> partitionIterator = context.getPartitionIterator(); final TableWrapper table = new TableWrapper(context.getTable()); final Iterator<org.apache.hadoop.hive.ql.metadata.Partition> qlPartitionIterator = Iterators.transform(partitionIterator, new Function<Partition, org.apache.hadoop.hive.ql.metadata.Partition>() { @Override public org.apache.hadoop.hive.ql.metadata.Partition apply(Partition partition) { try { return new PartitionWrapper(table, partition); } catch (Exception exception) { LOG.error("Could not construct partition-object for: " + partition, exception); throw new RuntimeException(exception); } } }); authorizer.authorize(new TableWrapper(context.getTable()), new Iterable<org.apache.hadoop.hive.ql.metadata.Partition>() { @Override public Iterator<org.apache.hadoop.hive.ql.metadata.Partition> iterator() { return qlPartitionIterator; } }, HiveOperation.ALTERTABLE_DROPPARTS.getInputRequiredPrivileges(), HiveOperation.ALTERTABLE_DROPPARTS.getOutputRequiredPrivileges()); }
tbl = get_table_core(catName, db_name, tbl_name, null); tableDataShouldBeDeleted = checkTableDataShouldBeDeleted(tbl, deleteData); firePreEvent(new PreDropPartitionEvent(tbl, part, deleteData, this)); mustPurge = isMustPurge(envContext, tbl);
private void authorizeDropPartition(PreDropPartitionEvent context) throws InvalidOperationException, MetaException { try { for (HiveMetastoreAuthorizationProvider authorizer : tAuthorizers.get()) { if (authorizer instanceof HiveMultiPartitionAuthorizationProviderBase) { // Authorize all dropped-partitions in one shot. authorizeDropMultiPartition((HiveMultiPartitionAuthorizationProviderBase)authorizer, context); } else { // Authorize individually. TableWrapper table = new TableWrapper(context.getTable()); Iterator<Partition> partitionIterator = context.getPartitionIterator(); while (partitionIterator.hasNext()) { authorizer.authorize( new PartitionWrapper(table, partitionIterator.next()), HiveOperation.ALTERTABLE_DROPPARTS.getInputRequiredPrivileges(), HiveOperation.ALTERTABLE_DROPPARTS.getOutputRequiredPrivileges() ); } } } } catch (AuthorizationException e) { throw invalidOperationException(e); } catch (HiveException e) { throw metaException(e); } }
firePreEvent(new PreDropPartitionEvent(tbl, part, deleteData, this)); if (colNames != null) { partNames.add(FileUtils.makePartName(colNames, part.getValues()));
private void authorizeDropPartition(PreDropPartitionEvent context) throws InvalidOperationException, MetaException { try { for (HiveMetastoreAuthorizationProvider authorizer : tAuthorizers.get()) { if (authorizer instanceof HiveMultiPartitionAuthorizationProviderBase) { // Authorize all dropped-partitions in one shot. authorizeDropMultiPartition((HiveMultiPartitionAuthorizationProviderBase)authorizer, context); } else { // Authorize individually. TableWrapper table = new TableWrapper(context.getTable()); Iterator<Partition> partitionIterator = context.getPartitionIterator(); while (partitionIterator.hasNext()) { authorizer.authorize( new PartitionWrapper(table, partitionIterator.next()), HiveOperation.ALTERTABLE_DROPPARTS.getInputRequiredPrivileges(), HiveOperation.ALTERTABLE_DROPPARTS.getOutputRequiredPrivileges() ); } } } } catch (AuthorizationException e) { throw invalidOperationException(e); } catch (HiveException e) { throw metaException(e); } }
tbl = get_table_core(catName, db_name, tbl_name); isExternalTbl = isExternal(tbl); firePreEvent(new PreDropPartitionEvent(tbl, part, deleteData, this)); mustPurge = isMustPurge(envContext, tbl);
validateTableInDropPartition(tbl, dropPart.getTable()); validateDropPartition(Collections.singletonList(part).iterator(), preDropPart.getPartitionIterator()); validateTableInDropPartition(tbl, preDropPart.getTable());
firePreEvent(new PreDropPartitionEvent(tbl, part, deleteData, this)); if (colNames != null) { partNames.add(FileUtils.makePartName(colNames, part.getValues()));
private void authorizeDropMultiPartition(HiveMultiPartitionAuthorizationProviderBase authorizer, final PreDropPartitionEvent context) throws AuthorizationException, HiveException { Iterator<Partition> partitionIterator = context.getPartitionIterator(); final TableWrapper table = new TableWrapper(context.getTable()); final Iterator<org.apache.hadoop.hive.ql.metadata.Partition> qlPartitionIterator = Iterators.transform(partitionIterator, new Function<Partition, org.apache.hadoop.hive.ql.metadata.Partition>() { @Override public org.apache.hadoop.hive.ql.metadata.Partition apply(Partition partition) { try { return new PartitionWrapper(table, partition); } catch (Exception exception) { LOG.error("Could not construct partition-object for: " + partition, exception); throw new RuntimeException(exception); } } }); authorizer.authorize(new TableWrapper(context.getTable()), new Iterable<org.apache.hadoop.hive.ql.metadata.Partition>() { @Override public Iterator<org.apache.hadoop.hive.ql.metadata.Partition> iterator() { return qlPartitionIterator; } }, HiveOperation.ALTERTABLE_DROPPARTS.getInputRequiredPrivileges(), HiveOperation.ALTERTABLE_DROPPARTS.getOutputRequiredPrivileges()); }
part = ms.getPartition(db_name, tbl_name, part_vals); tbl = get_table(db_name, tbl_name); firePreEvent(new PreDropPartitionEvent(tbl, part, this));
private void authorizeDropPartition(PreDropPartitionEvent context) throws InvalidOperationException, MetaException { try { for (HiveMetastoreAuthorizationProvider authorizer : tAuthorizers.get()) { if (authorizer instanceof HiveMultiPartitionAuthorizationProviderBase) { // Authorize all dropped-partitions in one shot. authorizeDropMultiPartition((HiveMultiPartitionAuthorizationProviderBase)authorizer, context); } else { // Authorize individually. TableWrapper table = new TableWrapper(context.getTable()); Iterator<Partition> partitionIterator = context.getPartitionIterator(); while (partitionIterator.hasNext()) { authorizer.authorize( new PartitionWrapper(table, partitionIterator.next()), HiveOperation.ALTERTABLE_DROPPARTS.getInputRequiredPrivileges(), HiveOperation.ALTERTABLE_DROPPARTS.getOutputRequiredPrivileges() ); } } } } catch (AuthorizationException e) { throw invalidOperationException(e); } catch (HiveException e) { throw metaException(e); } }
firePreEvent(new PreDropPartitionEvent(tbl, part, deleteData, this)); if (colNames != null) { partNames.add(FileUtils.makePartName(colNames, part.getValues()));
part = ms.getPartition(db_name, tbl_name, part_vals); tbl = get_table_core(db_name, tbl_name); firePreEvent(new PreDropPartitionEvent(tbl, part, deleteData, this)); mustPurge = isMustPurge(envContext, tbl);
part = ms.getPartition(db_name, tbl_name, part_vals); tbl = get_table_core(db_name, tbl_name); firePreEvent(new PreDropPartitionEvent(tbl, part, deleteData, this)); mustPurge = isMustPurge(envContext, tbl);