partialPartitionSpec.put("dt", "2012_01_01"); client.dropPartitions(dbName, tableName, partialPartitionSpec, true);
assertTrue(ptn != null); client.dropPartitions(dbName, tableName, firstPtn, true); ptnList = client.listPartitionsByFilter(dbName, tableName, null);
makePartLocation(table2Created,ptnDesc))); sourceMetastore.addPartition(HCatAddPartitionDesc.create(ptn).build()); sourceMetastore.dropPartitions(dbName,tblName2,ptnDesc,true);
public void dropPartition(String db, String table, String partitionSpec) throws Exception { String[] parts = partitionSpec.split(HCatURI.PARTITION_SEPARATOR); Map<String, String> partitions = new HashMap<String, String>(); for (String part : parts) { String[] split = part.split("="); partitions.put(split[0], split[1]); } hcatClient.dropPartitions(db, table, partitions, false); }
@Override public boolean delete(URI uri, Configuration conf) throws LauncherException { HCatClient client = getHCatClient(uri, conf); try { HCatURI hcatURI = new HCatURI(uri.toString()); if (!hcatURI.getPartitionMap().isEmpty()) { client.dropPartitions(hcatURI.getDb(), hcatURI.getTable(), hcatURI.getPartitionMap(), true); } else { client.dropTable(hcatURI.getDb(), hcatURI.getTable(), true); } System.out.println("Dropped partitions for " + uri); return true; } catch (ConnectionFailureException e) { throw new LauncherException("Error trying to drop " + uri, e); } catch (HCatException e) { throw new LauncherException("Error trying to drop " + uri, e); } catch (URISyntaxException e) { throw new LauncherException("Error trying to drop " + uri, e); } finally { closeQuietly(client); } }
@Override public boolean delete(URI uri, Configuration conf) throws LauncherException { HCatClient client = getHCatClient(uri, conf); try { HCatURI hcatURI = new HCatURI(uri.toString()); if (!hcatURI.getPartitionMap().isEmpty()) { client.dropPartitions(hcatURI.getDb(), hcatURI.getTable(), hcatURI.getPartitionMap(), true); } else { client.dropTable(hcatURI.getDb(), hcatURI.getTable(), true); } System.out.println("Dropped partitions for " + uri); return true; } catch (ConnectionFailureException e) { throw new LauncherException("Error trying to drop " + uri, e); } catch (HCatException e) { throw new LauncherException("Error trying to drop " + uri, e); } catch (URISyntaxException e) { throw new LauncherException("Error trying to drop " + uri, e); } finally { closeQuietly(client); } }
@Override public void delete(URI uri, Context context) throws URIHandlerException { HCatClient client = ((HCatContext) context).getHCatClient(); try { HCatURI hcatUri = new HCatURI(uri); if (!hcatUri.getPartitionMap().isEmpty()) { client.dropPartitions(hcatUri.getDb(), hcatUri.getTable(), hcatUri.getPartitionMap(), true); } else { client.dropTable(hcatUri.getDb(), hcatUri.getTable(), true); } } catch (URISyntaxException e) { throw new HCatAccessorException(ErrorCode.E1501, e); } catch (HCatException e) { throw new HCatAccessorException(ErrorCode.E1501, e); } }
@Override public void delete(URI uri, Context context) throws URIHandlerException { HCatClient client = ((HCatContext) context).getHCatClient(); try { HCatURI hcatUri = new HCatURI(uri); if (!hcatUri.getPartitionMap().isEmpty()) { client.dropPartitions(hcatUri.getDb(), hcatUri.getTable(), hcatUri.getPartitionMap(), true); } else { client.dropTable(hcatUri.getDb(), hcatUri.getTable(), true); } } catch (URISyntaxException e) { throw new HCatAccessorException(ErrorCode.E1501, e); } catch (HCatException e) { throw new HCatAccessorException(ErrorCode.E1501, e); } }
@Override public void delete(URI uri, Configuration conf, String user) throws URIHandlerException { HCatClientWithToken client = null; HCatClient hCatClient = null; try { HCatURI hcatUri = new HCatURI(uri); client = getHCatClient(uri, conf, user); hCatClient = client.getHCatClient(); if (!hcatUri.getPartitionMap().isEmpty()) { hCatClient.dropPartitions(hcatUri.getDb(), hcatUri.getTable(), hcatUri.getPartitionMap(), true); } else { hCatClient.dropTable(hcatUri.getDb(), hcatUri.getTable(), true); } } catch (URISyntaxException e){ throw new HCatAccessorException(ErrorCode.E1501, e); } catch (HCatException e) { throw new HCatAccessorException(ErrorCode.E1501, e); } finally { closeQuietly(hCatClient, client != null ? client.getDelegationToken() : null, true); } }
@Override public void delete(URI uri, Configuration conf, String user) throws URIHandlerException { HCatClientWithToken client = null; HCatClient hCatClient = null; try { HCatURI hcatUri = new HCatURI(uri); client = getHCatClient(uri, conf, user); hCatClient = client.getHCatClient(); if (!hcatUri.getPartitionMap().isEmpty()) { hCatClient.dropPartitions(hcatUri.getDb(), hcatUri.getTable(), hcatUri.getPartitionMap(), true); } else { hCatClient.dropTable(hcatUri.getDb(), hcatUri.getTable(), true); } } catch (URISyntaxException e){ throw new HCatAccessorException(ErrorCode.E1501, e); } catch (HCatException e) { throw new HCatAccessorException(ErrorCode.E1501, e); } finally { closeQuietly(hCatClient, client != null ? client.getDelegationToken() : null, true); } }