/** * Updates the existing partition metadata with the new metadata. * * @param tblName * name of the existing table * @param newPart * new partition * @throws InvalidOperationException * if the changes in metadata is not acceptable * @throws TException */ public void alterPartition(String tblName, Partition newPart, EnvironmentContext environmentContext) throws InvalidOperationException, HiveException { String[] names = Utilities.getDbTableName(tblName); alterPartition(names[0], names[1], newPart, environmentContext); }
private void alterPartitionSpec(Table tbl, Map<String, String> partSpec, org.apache.hadoop.hive.metastore.api.Partition tpart, boolean inheritTableSpecs, String partPath) throws HiveException, InvalidOperationException { alterPartitionSpecInMemory(tbl, partSpec, tpart, inheritTableSpecs, partPath); String fullName = tbl.getTableName(); if (!org.apache.commons.lang.StringUtils.isEmpty(tbl.getDbName())) { fullName = tbl.getDbName() + "." + tbl.getTableName(); } alterPartition(fullName, new Partition(tbl, tpart), null); }
/** * Updates the existing partition metadata with the new metadata. * * @param tblName * name of the existing table * @param newPart * new partition * @throws InvalidOperationException * if the changes in metadata is not acceptable * @throws TException */ @Deprecated public void alterPartition(String tblName, Partition newPart, EnvironmentContext environmentContext, boolean transactional) throws InvalidOperationException, HiveException { String[] names = Utilities.getDbTableName(tblName); alterPartition(null, names[0], names[1], newPart, environmentContext, transactional); }
private void alterPartitionSpec(Table tbl, Map<String, String> partSpec, org.apache.hadoop.hive.metastore.api.Partition tpart, boolean inheritTableSpecs, String partPath) throws HiveException, InvalidOperationException { alterPartitionSpecInMemory(tbl, partSpec, tpart, inheritTableSpecs, partPath); String fullName = tbl.getTableName(); if (!org.apache.commons.lang.StringUtils.isEmpty(tbl.getDbName())) { fullName = tbl.getFullyQualifiedName(); } alterPartition(tbl.getCatalogName(), tbl.getDbName(), tbl.getTableName(), new Partition(tbl, tpart), null, true); }
db.alterPartition(table.getCatalogName(), table.getDbName(), table.getTableName(), partn, null, true);
db.alterPartition(table.getDbName(), table.getTableName(), partn, null);
db.alterPartition(tbl.getTableName(), part, null); } else { Path url = new Path(tbl.getPath().toString());
db.alterPartition(simpleDesc.getTableName(), p, null, true);
try { db.alterPartition(simpleDesc.getTableName(), p, null, true); } catch (InvalidOperationException e) { throw new HiveException(e);
private List<Path> getLocations(Hive db, Table table, Map<String, String> partSpec) throws HiveException, InvalidOperationException { List<Path> locations = new ArrayList<Path>(); if (partSpec == null) { if (table.isPartitioned()) { for (Partition partition : db.getPartitions(table)) { locations.add(partition.getDataLocation()); EnvironmentContext environmentContext = new EnvironmentContext(); if (needToUpdateStats(partition.getParameters(), environmentContext)) { db.alterPartition(table.getDbName(), table.getTableName(), partition, environmentContext); } } } else { locations.add(table.getPath()); EnvironmentContext environmentContext = new EnvironmentContext(); if (needToUpdateStats(table.getParameters(), environmentContext)) { db.alterTable(table.getDbName()+"."+table.getTableName(), table, environmentContext); } } } else { for (Partition partition : db.getPartitionsByNames(table, partSpec)) { locations.add(partition.getDataLocation()); EnvironmentContext environmentContext = new EnvironmentContext(); if (needToUpdateStats(partition.getParameters(), environmentContext)) { db.alterPartition(table.getDbName(), table.getTableName(), partition, environmentContext); } } } return locations; }
db.alterPartition(simpleDesc.getTableName(), p, null);
setUnArchived(p); try { db.alterPartition(simpleDesc.getTableName(), p, null); } catch (InvalidOperationException e) { throw new HiveException(e);
db.alterPartition(tbl.getCatalogName(), tbl.getDbName(), tbl.getTableName(), part, environmentContext, true); } catch (InvalidOperationException e) {
db.alterPartition(touchDesc.getTableName(), part, environmentContext); } catch (InvalidOperationException e) { throw new HiveException(e);
p = db.getPartition(t, p.getSpec(), false); p.setLastAccessTime(lastAccessTime); db.alterPartition(null, dbName, tblName, p, null, false); t.setLastAccessTime(lastAccessTime); db.alterTable(dbName + "." + tblName, t, false, null, false);
p = db.getPartition(t, p.getSpec(), false); p.setLastAccessTime(lastAccessTime); db.alterPartition(t.getTableName(), p, null); t.setLastAccessTime(lastAccessTime); db.alterTable(t.getDbName() + "." + t.getTableName(), t, null);
/** * Updates the existing partition metadata with the new metadata. * * @param tblName * name of the existing table * @param newPart * new partition * @throws InvalidOperationException * if the changes in metadata is not acceptable * @throws TException */ public void alterPartition(String tblName, Partition newPart) throws InvalidOperationException, HiveException { String[] names = Utilities.getDbTableName(tblName); alterPartition(names[0], names[1], newPart); }
/** * Update existing partition * @param client hive client instance * @param fact fact name * @param partition partition to be updated * @throws InvalidOperationException * @throws HiveException */ public void updatePartition(Hive client, String fact, Partition partition) throws InvalidOperationException, HiveException { client.alterPartition(MetastoreUtil.getFactOrDimtableStorageTableName(fact, getName()), partition, null); }
/** * Update existing partition * @param client hive client instance * @param fact fact name * @param partition partition to be updated * @throws InvalidOperationException * @throws HiveException */ public void updatePartition(Hive client, String fact, Partition partition) throws InvalidOperationException, HiveException { client.alterPartition(MetastoreUtil.getFactOrDimtableStorageTableName(fact, getName()), partition, null); }
/** * Adds the partition. * * @param eventName the event name * @param key the key * @param finalPath the final path * @param className the class name * @return true, if successful */ private boolean addPartition(String eventName, String key, Path finalPath, String className) { try { Table t = getTable(eventName, className); HashMap<String, String> partSpec = new HashMap<String, String>(); partSpec.put("dt", key); Partition p = client.createPartition(t, partSpec); p.setLocation(finalPath.toString()); client.alterPartition(database, eventName, p, null); return true; } catch (Exception e) { LOG.warn("Unable to add the partition ", e); return false; } }