本文整理了Java中org.apache.hadoop.hive.metastore.api.Table.getCatName()
方法的一些代码示例,展示了Table.getCatName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getCatName()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.metastore.api.Table
类名称:Table
方法名:getCatName
暂无
代码示例来源:origin: apache/hive
public String getCatalogName() {
return this.tTable.getCatName();
}
代码示例来源:origin: apache/hive
public String getCatName() {
return tTable.getCatName();
}
代码示例来源:origin: apache/hive
boolean sameDatabase(String catName, String dbName) {
return catName.equals(t.getCatName()) && dbName.equals(t.getDbName());
}
代码示例来源:origin: apache/hive
private String getJDOFilterStrForPartitionVals(Table table, List<String> vals,
Map params) throws MetaException {
String partNameMatcher = MetaStoreUtils.makePartNameMatcher(table, vals, ".*");
StringBuilder queryFilter = new StringBuilder("table.database.name == dbName");
queryFilter.append(" && table.database.catalogName == catName");
queryFilter.append(" && table.tableName == tableName");
queryFilter.append(" && partitionName.matches(partialRegex)");
params.put("dbName", table.getDbName());
params.put("catName", table.getCatName());
params.put("tableName", table.getTableName());
params.put("partialRegex", partNameMatcher);
return queryFilter.toString();
}
代码示例来源:origin: apache/hive
private void getNextBatch() {
int batch_counter = 0;
List<String> nameBatch = new ArrayList<String>();
while (batch_counter < batch_size && partitionNamesIter.hasNext()) {
nameBatch.add(partitionNamesIter.next());
batch_counter++;
}
try {
batchIter =
msc.getPartitionsByNames(table.getCatName(), table.getDbName(), table.getTableName(), nameBatch).iterator();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: apache/hive
public T onTable(Table table) {
this.catName = table.getCatName();
this.dbName = table.getDbName();
this.tableName = table.getTableName();
return child;
}
代码示例来源:origin: apache/hive
private String getTableCatalog(Table table) {
String catName = table.isSetCatName() ? table.getCatName() :
MetaStoreUtils.getDefaultCatalog(getConf());
return catName.toLowerCase();
}
代码示例来源:origin: apache/hive
/**
* Get table name in cat.db.table format.
* @param table table object
* @return fully qualified name.
*/
public static String getCatalogQualifiedTableName(Table table) {
return TableName.getQualified(table.getCatName(), table.getDbName(), table.getTableName());
}
代码示例来源:origin: apache/hive
/**
* Primary constructor that fetches all partitions in a given table, given
* a Hive object and a table object, and a partial partition spec.
*/
public PartitionIterable(IMetaStoreClient msc, Table table, int batch_size) throws MetastoreException {
this.currType = Type.LAZY_FETCH_PARTITIONS;
this.msc = msc;
this.table = table;
this.batch_size = batch_size;
partitionNames = getPartitionNames(msc, table.getCatName(), table.getDbName(), table.getTableName(), (short) -1);
}
代码示例来源:origin: apache/hive
public static List<Partition> getAllPartitionsOf(IMetaStoreClient msc, Table table) throws MetastoreException {
try {
return msc.listPartitions(table.getCatName(), table.getDbName(), table.getTableName(), (short)-1);
} catch (Exception e) {
throw new MetastoreException(e);
}
}
代码示例来源:origin: apache/hive
public PartitionBuilder inTable(Table table) {
this.dbName = table.getDbName();
this.tableName = table.getTableName();
this.catName = table.getCatName();
setCols(table.getSd().getCols());
return this;
}
代码示例来源:origin: apache/hive
/**
* Gets the partition names from a table, pruned using an expression.
* @param table Table.
* @param expr Expression.
* @param defaultPartName Default partition name from job config, if any.
* @param maxParts Maximum number of partition names to return.
* @param result The resulting names.
* @return Whether the result contains any unknown partitions.
*/
private boolean getPartitionNamesPrunedByExprNoTxn(Table table, byte[] expr,
String defaultPartName, short maxParts, List<String> result) throws MetaException {
result.addAll(getPartitionNamesNoTxn(table.getCatName(),
table.getDbName(), table.getTableName(), maxParts));
return expressionProxy.filterPartitionsByExpr(table.getPartitionKeys(), expr,
getDefaultPartitionName(defaultPartName), result);
}
代码示例来源:origin: apache/hive
@Test
public void testTableExistsCaseInsensitive() throws Exception {
Table table = testTables[0];
// Test in upper case
Assert.assertTrue("Table exists", client.tableExists(table.getCatName().toUpperCase(),
table.getDbName().toUpperCase(), table.getTableName().toUpperCase()));
// Test in mixed case
Assert.assertTrue("Table exists", client.tableExists("hIVe", "DeFaUlt", "tEsT_TabLE"));
}
代码示例来源:origin: apache/hive
private boolean getPartitionNamesPrunedByExprNoTxn(Table table, byte[] expr,
String defaultPartName, short maxParts, List<String> result, SharedCache sharedCache)
throws MetaException, NoSuchObjectException {
List<Partition> parts =
sharedCache.listCachedPartitions(StringUtils.normalizeIdentifier(table.getCatName()),
StringUtils.normalizeIdentifier(table.getDbName()),
StringUtils.normalizeIdentifier(table.getTableName()), maxParts);
for (Partition part : parts) {
result.add(Warehouse.makePartName(table.getPartitionKeys(), part.getValues()));
}
if (defaultPartName == null || defaultPartName.isEmpty()) {
defaultPartName = MetastoreConf.getVar(getConf(), ConfVars.DEFAULTPARTITIONNAME);
}
return expressionProxy.filterPartitionsByExpr(table.getPartitionKeys(), expr, defaultPartName,
result);
}
代码示例来源:origin: apache/hive
@Test
public void testGetTableCaseInsensitive() throws Exception {
Table table = testTables[0];
// Test in upper case
Table resultUpper = client.getTable(table.getCatName().toUpperCase(),
table.getDbName().toUpperCase(), table.getTableName().toUpperCase());
Assert.assertEquals("Comparing tables", table, resultUpper);
// Test in mixed case
Table resultMix = client.getTable("hIvE", "DeFaUlt", "tEsT_TabLE");
Assert.assertEquals("Comparing tables", table, resultMix);
}
代码示例来源:origin: apache/hive
@Test
public void dropNoSuchTable() throws TException {
try {
client.dropConstraint(testTables[0].getCatName(), testTables[0].getDbName(),
"nosuch", "mypk");
Assert.fail();
} catch (InvalidObjectException|TApplicationException e) {
// NOP
}
}
代码示例来源:origin: apache/hive
@Test
public void dropNoSuchDatabase() throws TException {
try {
client.dropConstraint(testTables[0].getCatName(), "nosuch",
testTables[0].getTableName(), "mypk");
Assert.fail();
} catch (InvalidObjectException|TApplicationException e) {
// NOP
}
}
代码示例来源:origin: apache/hive
@Test
public void dropNoSuchConstraint() throws TException {
try {
client.dropConstraint(testTables[0].getCatName(), testTables[0].getDbName(),
testTables[0].getTableName(), "nosuch");
Assert.fail();
} catch (InvalidObjectException|TApplicationException e) {
// NOP
}
}
代码示例来源:origin: apache/hive
@Test
public void testTableExists() throws Exception {
// Using the second table, since a table called "test_table" exists in both databases
Table table = testTables[1];
Assert.assertTrue("Table exists", client.tableExists(table.getCatName(), table.getDbName(),
table.getTableName()));
Assert.assertFalse("Table not exists", client.tableExists(table.getCatName(), table.getDbName(),
"non_existing_table"));
// No such database
Assert.assertFalse("Table not exists", client.tableExists("no_such_database",
table.getTableName()));
// No such table in the given database
Assert.assertFalse("Table not exists", client.tableExists(OTHER_DATABASE,
table.getTableName()));
}
代码示例来源:origin: apache/hive
@Override
public void onInsert(InsertEvent insertEvent) throws MetaException {
Table tableObj = insertEvent.getTableObj();
InsertMessage msg = MessageBuilder.getInstance().buildInsertMessage(tableObj,
insertEvent.getPartitionObj(), insertEvent.isReplace(),
new FileChksumIterator(insertEvent.getFiles(), insertEvent.getFileChecksums()));
NotificationEvent event =
new NotificationEvent(0, now(), EventType.INSERT.toString(),
msgEncoder.getSerializer().serialize(msg));
event.setCatName(tableObj.isSetCatName() ? tableObj.getCatName() : DEFAULT_CATALOG_NAME);
event.setDbName(tableObj.getDbName());
event.setTableName(tableObj.getTableName());
process(event, insertEvent);
}
内容来源于网络,如有侵权,请联系作者删除!