@Test public void typicalDropPartition() throws TException { boolean result = hiveClient.dropPartition(DATABASE, TABLE_NAME, PARTITION_NAME); verify(client).dropPartition(DATABASE, TABLE_NAME, PARTITION_NAME, false); assertTrue(result); }
@Override public boolean dropPartition(String databaseName, String tableName, String partitionName) { boolean partitionDeleted = true; if (dryRunEnabled) { log.info("Dry run - dropping partition \"{}\" from table \"{}.{}\"", partitionName, databaseName, tableName); } else { try { log.info("Dropping partition \"{}\" from table \"{}.{}\"", partitionName, databaseName, tableName); client.dropPartition(databaseName, tableName, partitionName, false); } catch (NoSuchObjectException e) { log .info("Could not drop partition \"{}\" from table \"{}.{}\". Partition does not exist.", partitionName, databaseName, tableName); partitionDeleted = false; } catch (TException e) { throw new BeekeeperException("Unexpected exception when dropping partition \"" + partitionName + "\" from table: \"" + databaseName + "." + tableName + "\".", e); } } return partitionDeleted; }
HiveClient implements CleanerClient { @Override public boolean dropPartition(String databaseName, String tableName, String partitionName) { boolean partitionDeleted = true; if (dryRunEnabled) { log.info("Dry run - dropping partition \"{}\" from table \"{}.{}\"", partitionName, databaseName, tableName); } else { try { log.info("Dropping partition \"{}\" from table \"{}.{}\"", partitionName, databaseName, tableName); client.dropPartition(databaseName, tableName, partitionName, false); } catch (NoSuchObjectException e) { log .info("Could not drop partition \"{}\" from table \"{}.{}\". Partition does not exist.", partitionName, databaseName, tableName); partitionDeleted = false; } catch (TException e) { throw new BeekeeperException("Unexpected exception when dropping partition \"" + partitionName + "\" from table: \"" + databaseName + "." + tableName + "\".", e); } } return partitionDeleted; } }
HiveClient implements CleanerClient { @Override public boolean dropPartition(String databaseName, String tableName, String partitionName) { boolean partitionDeleted = true; if (dryRunEnabled) { log.info("Dry run - dropping partition \"{}\" from table \"{}.{}\"", partitionName, databaseName, tableName); } else { try { log.info("Dropping partition \"{}\" from table \"{}.{}\"", partitionName, databaseName, tableName); client.dropPartition(databaseName, tableName, partitionName, false); } catch (NoSuchObjectException e) { log .info("Could not drop partition \"{}\" from table \"{}.{}\". Partition does not exist.", partitionName, databaseName, tableName); partitionDeleted = false; } catch (TException e) { throw new BeekeeperException("Unexpected exception when dropping partition \"" + partitionName + "\" from table: \"" + databaseName + "." + tableName + "\".", e); } } return partitionDeleted; } HiveClient(CloseableMetaStoreClient client, boolean dryRunEnabled); }
HiveClient implements CleanerClient { @Override public boolean dropPartition(String databaseName, String tableName, String partitionName) { boolean partitionDeleted = true; if (dryRunEnabled) { log.info("Dry run - dropping partition \"{}\" from table \"{}.{}\"", partitionName, databaseName, tableName); } else { try { log.info("Dropping partition \"{}\" from table \"{}.{}\"", partitionName, databaseName, tableName); client.dropPartition(databaseName, tableName, partitionName, false); } catch (NoSuchObjectException e) { log .info("Could not drop partition \"{}\" from table \"{}.{}\". Partition does not exist.", partitionName, databaseName, tableName); partitionDeleted = false; } catch (TException e) { throw new BeekeeperException("Unexpected exception when dropping partition \"" + partitionName + "\" from table: \"" + databaseName + "." + tableName + "\".", e); } } return partitionDeleted; } HiveClient(CloseableMetaStoreClient client, boolean dryRunEnabled); @Override void dropTable(String databaseName, String tableName); @Override boolean dropPartition(String databaseName, String tableName, String partitionName); @Override boolean tableExists(String databaseName, String tableName); @Override void close(); }
HiveClient implements CleanerClient { @Override public boolean dropPartition(String databaseName, String tableName, String partitionName) { boolean partitionDeleted = true; if (dryRunEnabled) { log.info("Dry run - dropping partition \"{}\" from table \"{}.{}\"", partitionName, databaseName, tableName); } else { try { log.info("Dropping partition \"{}\" from table \"{}.{}\"", partitionName, databaseName, tableName); client.dropPartition(databaseName, tableName, partitionName, false); } catch (NoSuchObjectException e) { log .info("Could not drop partition \"{}\" from table \"{}.{}\". Partition does not exist.", partitionName, databaseName, tableName); partitionDeleted = false; } catch (TException e) { throw new BeekeeperException("Unexpected exception when dropping partition \"" + partitionName + "\" from table: \"" + databaseName + "." + tableName + "\".", e); } } return partitionDeleted; } HiveClient(CloseableMetaStoreClient client, boolean dryRunEnabled); @Override void dropTable(String databaseName, String tableName); @Override boolean dropPartition(String databaseName, String tableName, String partitionName); @Override boolean tableExists(String databaseName, String tableName); @Override void close();  }