org.apache.hadoop.hive.ql.metadata.Hive.dropTable()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(248)

本文整理了Java中org.apache.hadoop.hive.ql.metadata.Hive.dropTable()方法的一些代码示例,展示了Hive.dropTable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hive.dropTable()方法的具体详情如下:
包路径:org.apache.hadoop.hive.ql.metadata.Hive
类名称:Hive
方法名:dropTable

Hive.dropTable介绍

[英]Drops table along with the data in it. If the table doesn't exist then it is a no-op
[中]将表连同其中的数据一起删除。如果该表不存在,则表示不存在操作

代码示例

代码示例来源:origin: apache/hive

/**
 * Drops table along with the data in it. If the table doesn't exist then it
 * is a no-op
 *
 * @param tableName
 *          table to drop
 * @throws HiveException
 *           thrown if the drop fails
 */
public void dropTable(String tableName) throws HiveException {
 dropTable(tableName, false);
}

代码示例来源:origin: apache/hive

/**
 * Drops table along with the data in it. If the table doesn't exist then it
 * is a no-op
 *
 * @param dbName
 *          database where the table lives
 * @param tableName
 *          table to drop
 * @throws HiveException
 *           thrown if the drop fails
 */
public void dropTable(String dbName, String tableName) throws HiveException {
 dropTable(dbName, tableName, true, true, false);
}

代码示例来源:origin: apache/drill

/**
 * Drops table along with the data in it. If the table doesn't exist then it
 * is a no-op
 *
 * @param tableName
 *          table to drop
 * @throws HiveException
 *           thrown if the drop fails
 */
public void dropTable(String tableName) throws HiveException {
 dropTable(tableName, false);
}

代码示例来源:origin: apache/drill

/**
 * Drops table along with the data in it. If the table doesn't exist then it
 * is a no-op
 *
 * @param dbName
 *          database where the table lives
 * @param tableName
 *          table to drop
 * @throws HiveException
 *           thrown if the drop fails
 */
public void dropTable(String dbName, String tableName) throws HiveException {
 dropTable(dbName, tableName, true, true, false);
}

代码示例来源:origin: apache/hive

/**
 * Drops the table.
 *
 * @param dbName
 * @param tableName
 * @param deleteData
 *          deletes the underlying data along with metadata
 * @param ignoreUnknownTab
 *          an exception is thrown if this is false and the table doesn't exist
 * @throws HiveException
 */
public void dropTable(String dbName, String tableName, boolean deleteData,
  boolean ignoreUnknownTab) throws HiveException {
 dropTable(dbName, tableName, deleteData, ignoreUnknownTab, false);
}

代码示例来源:origin: apache/drill

/**
 * Drops the table.
 *
 * @param dbName
 * @param tableName
 * @param deleteData
 *          deletes the underlying data along with metadata
 * @param ignoreUnknownTab
 *          an exception is thrown if this is false and the table doesn't exist
 * @throws HiveException
 */
public void dropTable(String dbName, String tableName, boolean deleteData,
  boolean ignoreUnknownTab) throws HiveException {
 dropTable(dbName, tableName, deleteData, ignoreUnknownTab, false);
}

代码示例来源:origin: apache/hive

public void cleanupTables() throws HiveException {
 if (db != null) {
  db.dropTable("T");
  db.dropTable("U");
 }
}

代码示例来源:origin: apache/hive

/**
 * Drops table along with the data in it. If the table doesn't exist then it
 * is a no-op. If ifPurge option is specified it is passed to the
 * hdfs command that removes table data from warehouse to make it skip trash.
 *
 * @param tableName
 *          table to drop
 * @param ifPurge
 *          completely purge the table (skipping trash) while removing data from warehouse
 * @throws HiveException
 *           thrown if the drop fails
 */
public void dropTable(String tableName, boolean ifPurge) throws HiveException {
 String[] names = Utilities.getDbTableName(tableName);
 dropTable(names[0], names[1], true, true, ifPurge);
}

代码示例来源:origin: apache/drill

/**
 * Drops table along with the data in it. If the table doesn't exist then it
 * is a no-op. If ifPurge option is specified it is passed to the
 * hdfs command that removes table data from warehouse to make it skip trash.
 *
 * @param tableName
 *          table to drop
 * @param ifPurge
 *          completely purge the table (skipping trash) while removing data from warehouse
 * @throws HiveException
 *           thrown if the drop fails
 */
public void dropTable(String tableName, boolean ifPurge) throws HiveException {
 String[] names = Utilities.getDbTableName(tableName);
 dropTable(names[0], names[1], true, true, ifPurge);
}

代码示例来源:origin: apache/hive

private void cleanUpTableQuietly(String dbName, String tableName) {
 try {
  hm.dropTable(dbName, tableName, true, true, true);
 }
 catch(Exception exception) {
  fail("Unexpected exception: " + StringUtils.stringifyException(exception));
 }
}

代码示例来源:origin: apache/hive

@AfterClass
public static void deInit() throws Exception {
 Hive h = Hive.get(conf);
 h.dropTable("foo");
}

代码示例来源:origin: apache/hive

private Table createPartitionedTable(String dbName, String tableName) throws Exception {
 try {
  hm.dropTable(dbName, tableName);
  hm.createTable(tableName,
          Arrays.asList("key", "value"),   // Data columns.
          Arrays.asList("ds", "hr"),       // Partition columns.
          TextInputFormat.class,
          HiveIgnoreKeyTextOutputFormat.class);
  return hm.getTable(dbName, tableName);
 }
 catch (Exception exception) {
  fail("Unable to drop and create table " + StatsUtils.getFullyQualifiedTableName(dbName, tableName)
    + " because " + StringUtils.stringifyException(exception));
  throw exception;
 }
}

代码示例来源:origin: apache/hive

String tableName = "table_for_testpartition";
 try {
  hm.dropTable(Warehouse.DEFAULT_DATABASE_NAME, tableName);
 } catch (HiveException e) {
  System.err.println(StringUtils.stringifyException(e));
  assertTrue("Unable to create parition for table: " + tableName, false);
 hm.dropTable(Warehouse.DEFAULT_DATABASE_NAME, tableName);
} catch (Throwable e) {
 System.err.println(StringUtils.stringifyException(e));

代码示例来源:origin: apache/hive

/**
 * Removes all databases and tables from the metastore
 */
public static void cleanupHMS(Hive hive, Warehouse wh, FsPermission defaultPerm)
 throws HiveException, MetaException, NoSuchObjectException {
 for (String dbName : hive.getAllDatabases()) {
  if (dbName.equals("default")) {
   continue;
  }
  try {
   Path path = getDbPath(hive, wh, dbName);
   FileSystem whFs = path.getFileSystem(hive.getConf());
   whFs.setPermission(path, defaultPerm);
  } catch (IOException ex) {
   //ignore
  }
  hive.dropDatabase(dbName, true, true, true);
 }
 //clean tables in default db
 for (String tablename : hive.getAllTables("default")) {
  hive.dropTable("default", tablename, true, true);
 }
}

代码示例来源:origin: apache/hive

try {
 try {
  hm.dropTable(Warehouse.DEFAULT_DATABASE_NAME, tableName);
 } catch (HiveException e1) {
  System.err.println(StringUtils.stringifyException(e1));
 hm.dropTable(DEFAULT_DATABASE_NAME, tableName);
} catch (Throwable e) {
 System.err.println(StringUtils.stringifyException(e));

代码示例来源:origin: apache/hive

@Test
public void testDataDeletion() throws HiveException,
 IOException, TException {
 Database db = new Database();
 db.setName(dbName);
 hive.createDatabase(db);
 Table table = new Table(dbName, tableName);
 table.setDbName(dbName);
 table.setInputFormatClass(TextInputFormat.class);
 table.setOutputFormatClass(HiveIgnoreKeyTextOutputFormat.class);
 table.setPartCols(partCols);
 hive.createTable(table);
 table = hive.getTable(dbName, tableName);
 Path fakeTable = table.getPath().getParent().suffix(
   Path.SEPARATOR + "faketable");
 fs = fakeTable.getFileSystem(hive.getConf());
 fs.mkdirs(fakeTable);
 fs.deleteOnExit(fakeTable);
 Path fakePart = new Path(table.getDataLocation().toString(),
   "fakepartition=fakevalue");
 fs.mkdirs(fakePart);
 fs.deleteOnExit(fakePart);
 hive.dropTable(dbName, tableName, true, true);
 assertFalse(fs.exists(fakePart));
 hive.dropDatabase(dbName);
 assertFalse(fs.exists(fakeTable));
}

代码示例来源:origin: apache/hive

assertTrue(fs.exists(table1.getPath()));
hm.dropTable(dbName, table1Name);
assertFalse(fs.exists(table1.getPath()));
 hm.dropTable(dbName, tableName);
 assertFalse(fs.exists(table.getPath()));

代码示例来源:origin: apache/hive

Path pathglob = trash1.suffix("*");;
FileStatus before[] = fs.globStatus(pathglob);
hm.dropTable(dbName, ts.get(0));
assertFalse(fs.exists(path1));
FileStatus after[] = fs.globStatus(pathglob);
pathglob = trash2.suffix("*");
before = fs.globStatus(pathglob);
hm.dropTable(dbName, ts.get(1), true, true, true); // deleteData, ignoreUnknownTable, ifPurge
assertFalse(fs.exists(path2));
after = fs.globStatus(pathglob);
 hm.dropTable(dbName, tableName);
 assertFalse(fs.exists(table.getPath()));

代码示例来源:origin: apache/hive

hive.dropTable(dbName, tableName, true, true);
hive.createTable(table);
result = new CheckResult();

代码示例来源:origin: apache/hive

hm.dropTable(dbName, tableName);
trashSizeAfterDrop = getTrashContents().length;

相关文章

Hive类方法