private void setStatsPropAndAlterPartitions(boolean resetStatistics, Table tbl, List<Partition> partitions, long writeId) throws TException { if (partitions.isEmpty()) { return; } EnvironmentContext ec = new EnvironmentContext(); if (!resetStatistics) { ec.putToProperties(StatsSetupConst.DO_NOT_UPDATE_STATS, StatsSetupConst.TRUE); } if (LOG.isDebugEnabled()) { StringBuilder sb = new StringBuilder("Altering existing partitions "); partitions.forEach(p -> sb.append(p.getSpec())); LOG.debug(sb.toString()); } getSynchronizedMSC().alter_partitions(tbl.getCatName(), tbl.getDbName(), tbl.getTableName(), partitions.stream().map(Partition::getTPartition).collect(Collectors.toList()), ec, null, writeId); }
public void alterTable(Table newTbl, boolean cascade, EnvironmentContext environmentContext, boolean transactional) throws HiveException { alterTable(newTbl.getCatName(), newTbl.getDbName(), newTbl.getTableName(), newTbl, cascade, environmentContext, transactional); }
private void setStatsPropAndAlterPartition(boolean resetStatistics, Table tbl, Partition newTPart, TableSnapshot tableSnapshot) throws TException { EnvironmentContext ec = new EnvironmentContext(); if (!resetStatistics) { ec.putToProperties(StatsSetupConst.DO_NOT_UPDATE_STATS, StatsSetupConst.TRUE); } LOG.debug("Altering existing partition " + newTPart.getSpec()); getSynchronizedMSC().alter_partition(tbl.getCatName(), tbl.getDbName(), tbl.getTableName(), newTPart.getTPartition(), new EnvironmentContext(), tableSnapshot == null ? null : tableSnapshot.getValidWriteIdList()); }
getMSC().renamePartition(tbl.getCatName(), tbl.getDbName(), tbl.getTableName(), pvals, newPart.getTPartition(), validWriteIds);
/** * Check privileges on User, DB and table objects. * * @param table * @param inputRequiredPriv * @param outputRequiredPriv * @param inputCheck * @param outputCheck * @return true if the check passed * @throws HiveException */ private boolean authorizeUserDBAndTable(Table table, Privilege[] inputRequiredPriv, Privilege[] outputRequiredPriv, boolean[] inputCheck, boolean[] outputCheck) throws HiveException { if (authorizeUserAndDBPriv(hive_db.getDatabase(table.getCatName(), table.getDbName()), inputRequiredPriv, outputRequiredPriv, inputCheck, outputCheck)) { return true; } PrincipalPrivilegeSet tablePrivileges = hive_db.get_privilege_set( HiveObjectType.TABLE, table.getDbName(), table.getTableName(), null, null, this.getAuthenticator().getUserName(), this.getAuthenticator() .getGroupNames()); if (authorizePrivileges(tablePrivileges, inputRequiredPriv, inputCheck, outputRequiredPriv, outputCheck)) { return true; } return false; }
authorize(hive_db.getDatabase(table.getCatName(), table.getDbName()), new Privilege[] {}, new Privilege[] { Privilege.ALTER_DATA });
alterTable(tbl.getCatName(), tbl.getDbName(), tbl.getTableName(), tbl, false, environmentContext, true, ((writeId == null) ? 0 : writeId));
db.alterTable(tbl.getCatName(), tbl.getDbName(), tbl.getTableName(), tbl, false, environmentContext, true, writeId); } else {
colStatsDesc.setCatName(tbl.getCatName()); colStatsDesc.setDbName(getTableName()); colStatsDesc.setDbName(getDatabaseName());
hive_db.getDatabase(part.getTable().getCatName(), part.getTable().getDbName()), inputRequiredPriv, outputRequiredPriv, inputCheck, outputCheck)) { return true;