Java Code Examples for org.apache.hadoop.hive.metastore.IMetaStoreClient#getTable()
The following examples show how to use
org.apache.hadoop.hive.metastore.IMetaStoreClient#getTable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HiveShimV1.java From flink with Apache License 2.0 | 6 votes |
@Override // 1.x client doesn't support filtering tables by type, so here we need to get all tables and filter by ourselves public List<String> getViews(IMetaStoreClient client, String databaseName) throws UnknownDBException, TException { // We don't have to use reflection here because client.getAllTables(String) is supposed to be there for // all versions. List<String> tableNames = client.getAllTables(databaseName); List<String> views = new ArrayList<>(); for (String name : tableNames) { Table table = client.getTable(databaseName, name); String viewDef = table.getViewOriginalText(); if (viewDef != null && !viewDef.isEmpty()) { views.add(table.getTableName()); } } return views; }
Example 2
Source File: HiveShimV100.java From flink with Apache License 2.0 | 6 votes |
@Override // 1.x client doesn't support filtering tables by type, so here we need to get all tables and filter by ourselves public List<String> getViews(IMetaStoreClient client, String databaseName) throws UnknownDBException, TException { // We don't have to use reflection here because client.getAllTables(String) is supposed to be there for // all versions. List<String> tableNames = client.getAllTables(databaseName); List<String> views = new ArrayList<>(); for (String name : tableNames) { Table table = client.getTable(databaseName, name); String viewDef = table.getViewOriginalText(); if (viewDef != null && !viewDef.isEmpty()) { views.add(table.getTableName()); } } return views; }
Example 3
Source File: HiveClientWrapper.java From pxf with Apache License 2.0 | 5 votes |
public Table getHiveTable(IMetaStoreClient client, Metadata.Item itemName) throws Exception { Table tbl = client.getTable(itemName.getPath(), itemName.getName()); String tblType = tbl.getTableType(); LOG.debug("Item: {}.{}, type: {}", itemName.getPath(), itemName.getName(), tblType); if (TableType.valueOf(tblType) == TableType.VIRTUAL_VIEW) { throw new UnsupportedOperationException("Hive views are not supported by PXF"); } return tbl; }
Example 4
Source File: HiveCatalogUtil.java From tajo with Apache License 2.0 | 4 votes |
public static Table getTable(IMetaStoreClient client, String dbName, String tableName) throws TException { return new Table(client.getTable(dbName, tableName)); }