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

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

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

Hive.getTablesByType介绍

[英]Returns all existing tables of a type (VIRTUAL_VIEW|EXTERNAL_TABLE|MANAGED_TABLE) from the specified database which match the given pattern. The matching occurs as per Java regular expressions.
[中]返回指定数据库中与给定模式匹配的某一类型(虚拟|视图|外部|表|托管|表)的所有现有表。匹配按照Java正则表达式进行。

代码示例

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

/**
 * Get all materialized view names for the specified database.
 * @param dbName
 * @return List of materialized view table names
 * @throws HiveException
 */
public List<String> getAllMaterializedViews(String dbName) throws HiveException {
 return getTablesByType(dbName, ".*", TableType.MATERIALIZED_VIEW);
}

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

/**
 * Get all table names for the specified database.
 * @param dbName
 * @return List of table names
 * @throws HiveException
 */
public List<String> getAllTables(String dbName) throws HiveException {
 return getTablesByType(dbName, ".*", null);
}

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

/**
 * Returns all existing tables from the specified database which match the given
 * pattern. The matching occurs as per Java regular expressions.
 * @param dbName
 * @param tablePattern
 * @return list of table names
 * @throws HiveException
 */
public List<String> getTablesByPattern(String dbName, String tablePattern) throws HiveException {
 return getTablesByType(dbName, tablePattern, null);
}

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

/**
 * Returns all existing tables from the given database which match the given
 * pattern. The matching occurs as per Java regular expressions
 *
 * @param database
 *          the database name
 * @param tablePattern
 *          java re pattern
 * @return list of table names
 * @throws HiveException
 */
public List<String> getTablesForDb(String database, String tablePattern)
  throws HiveException {
 return getTablesByType(database, tablePattern, null);
}

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

/**
 * Get all table names for the specified database.
 * @param dbName
 * @return List of table names
 * @throws HiveException
 */
public List<String> getAllTables(String dbName) throws HiveException {
 return getTablesByType(dbName, ".*", null);
}

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

/**
 * Returns all existing tables from the specified database which match the given
 * pattern. The matching occurs as per Java regular expressions.
 * @param dbName
 * @param tablePattern
 * @return list of table names
 * @throws HiveException
 */
public List<String> getTablesByPattern(String dbName, String tablePattern) throws HiveException {
 return getTablesByType(dbName, tablePattern, null);
}

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

/**
 * Returns all existing tables from the given database which match the given
 * pattern. The matching occurs as per Java regular expressions
 *
 * @param database
 *          the database name
 * @param tablePattern
 *          java re pattern
 * @return list of table names
 * @throws HiveException
 */
public List<String> getTablesForDb(String database, String tablePattern)
  throws HiveException {
 return getTablesByType(database, tablePattern, null);
}

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

/**
 * Get all table names for the current database.
 * @return List of table names
 * @throws HiveException
 */
public List<String> getAllTables() throws HiveException {
 return getTablesByType(SessionState.get().getCurrentDatabase(), null, null);
}

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

/**
 * Returns all existing tables from default database which match the given
 * pattern. The matching occurs as per Java regular expressions
 *
 * @param tablePattern
 *          java re pattern
 * @return list of table names
 * @throws HiveException
 */
public List<String> getTablesByPattern(String tablePattern) throws HiveException {
 return getTablesByType(SessionState.get().getCurrentDatabase(),
   tablePattern, null);
}

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

/**
 * Get all table names for the current database.
 * @return List of table names
 * @throws HiveException
 */
public List<String> getAllTables() throws HiveException {
 return getTablesByType(SessionState.get().getCurrentDatabase(), null, null);
}

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

private List<Table> getTableObjects(String dbName, String pattern, TableType tableType) throws HiveException {
 try {
  return Lists.transform(getMSC().getTableObjectsByName(dbName, getTablesByType(dbName, pattern, tableType)),
   new com.google.common.base.Function<org.apache.hadoop.hive.metastore.api.Table, Table>() {
    @Override
    public Table apply(org.apache.hadoop.hive.metastore.api.Table table) {
     return new Table(table);
    }
   }
  );
 } catch (Exception e) {
  throw new HiveException(e);
 }
}

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

/**
 * Returns all existing tables from default database which match the given
 * pattern. The matching occurs as per Java regular expressions
 *
 * @param tablePattern
 *          java re pattern
 * @return list of table names
 * @throws HiveException
 */
public List<String> getTablesByPattern(String tablePattern) throws HiveException {
 return getTablesByType(SessionState.get().getCurrentDatabase(),
   tablePattern, null);
}

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

if (type == null) {
 tablesOrViews = new ArrayList<>();
 tablesOrViews.addAll(db.getTablesByType(dbName, pattern, TableType.MANAGED_TABLE));
 tablesOrViews.addAll(db.getTablesByType(dbName, pattern, TableType.EXTERNAL_TABLE));
 LOG.debug("Found {} table(s) matching the SHOW TABLES statement.", tablesOrViews.size());
} else if (type == TableType.MATERIALIZED_VIEW) {
 LOG.debug("Found {} materialized view(s) matching the SHOW MATERIALIZED VIEWS statement.", materializedViews.size());
} else if (type == TableType.VIRTUAL_VIEW) {
 tablesOrViews = db.getTablesByType(dbName, pattern, type);
 LOG.debug("Found {} view(s) matching the SHOW VIEWS statement.", tablesOrViews.size());
} else {

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

tablesOrViews = db.getTablesByType(dbName, pattern, type);
LOG.debug("results : " + tablesOrViews.size());

相关文章

Hive类方法