本文整理了Java中org.apache.hadoop.hive.metastore.api.Partition.getCatName()
方法的一些代码示例,展示了Partition.getCatName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Partition.getCatName()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.metastore.api.Partition
类名称:Partition
方法名:getCatName
暂无
代码示例来源:origin: apache/hive
@Override public String getCatName() { return partition.getCatName(); }
@Override public String getDbName() { return partition.getDbName(); }
代码示例来源:origin: apache/hive
ret = add_partitions_core(getMS(), parts.get(0).getCatName(), parts.get(0).getDbName(),
parts.get(0).getTableName(), parts, false).size();
assert ret == parts.size();
代码示例来源:origin: apache/hive
/**
* Filter the partition if filtering is enabled. Otherwise, return original object
* @param isFilterEnabled true: filtering is enabled; false: filtring is disabled.
* @param filterHook: the object that does filtering
* @param p: the partition object
* @return the partition object that user has access or original list if filtering is disabled;
* Otherwise, throw NoSuchObjectException
* @throws MetaException
* @throws NoSuchObjectException
*/
public static Partition filterPartitionIfEnabled(
boolean isFilterEnabled,
MetaStoreFilterHook filterHook, Partition p) throws MetaException, NoSuchObjectException {
if (isFilterEnabled) {
Partition filteredPartition = filterHook.filterPartition(p);
if (filteredPartition == null) {
throw new NoSuchObjectException("Partition in " + p.getCatName() + CATALOG_DB_SEPARATOR + p.getDbName() + "." +
p.getTableName() + " not found.");
}
}
return p;
}
代码示例来源:origin: apache/hive
@Override
public List<Partition> add_partitions(
List<Partition> parts, boolean ifNotExists, boolean needResults) throws TException {
if (parts == null || parts.contains(null)) {
throw new MetaException("Partitions cannot be null.");
}
if (parts.isEmpty()) {
return needResults ? new ArrayList<>() : null;
}
Partition part = parts.get(0);
// Have to set it for each partition too
if (!part.isSetCatName()) {
final String defaultCat = getDefaultCatalog(conf);
parts.forEach(p -> p.setCatName(defaultCat));
}
AddPartitionsRequest req = new AddPartitionsRequest(
part.getDbName(), part.getTableName(), parts, ifNotExists);
req.setCatName(part.isSetCatName() ? part.getCatName() : getDefaultCatalog(conf));
req.setNeedResult(needResults);
AddPartitionsResult result = client.add_partitions_req(req);
return needResults ? FilterUtils.filterPartitionsIfEnabled(
isClientFilterEnabled, filterHook, result.getPartitions()) : null;
}
代码示例来源:origin: apache/hive
private boolean startAddPartition(
RawStore ms, Partition part, List<FieldSchema> partitionKeys, boolean ifNotExists)
throws TException {
MetaStoreServerUtils.validatePartitionNameCharacters(part.getValues(),
partitionValidationPattern);
boolean doesExist = ms.doesPartitionExist(part.getCatName(),
part.getDbName(), part.getTableName(), partitionKeys, part.getValues());
if (doesExist && !ifNotExists) {
throw new AlreadyExistsException("Partition already exists: " + part);
}
return !doesExist;
}
代码示例来源:origin: apache/hive
private boolean isValidPartition(
Partition part, List<FieldSchema> partitionKeys, boolean ifNotExists) throws MetaException {
MetaStoreServerUtils.validatePartitionNameCharacters(part.getValues(),
partitionValidationPattern);
boolean doesExist = doesPartitionExist(part.getCatName(),
part.getDbName(), part.getTableName(), partitionKeys, part.getValues());
if (doesExist && !ifNotExists) {
throw new MetaException("Partition already exists: " + part);
}
return !doesExist;
}
代码示例来源:origin: apache/hive
private void setPartitionSkipProperty(
IMetaStoreClient msClient, String tblName, String partName, String val) throws Exception {
Partition part = msClient.getPartition(ss.getCurrentDatabase(), tblName, partName);
part.getParameters().put(StatsUpdaterThread.SKIP_STATS_AUTOUPDATE_PROPERTY, val);
msClient.alter_partition(part.getCatName(), part.getDbName(), tblName, part);
}
代码示例来源:origin: apache/hive
@Override
public boolean addPartition(Partition part) throws InvalidObjectException, MetaException {
boolean succ = rawStore.addPartition(part);
// in case of event based cache update, cache will be updated during commit.
if (succ && !canUseEvents) {
String dbName = normalizeIdentifier(part.getDbName());
String tblName = normalizeIdentifier(part.getTableName());
String catName = part.isSetCatName() ? normalizeIdentifier(part.getCatName()) : DEFAULT_CATALOG_NAME;
if (!shouldCacheTable(catName, dbName, tblName)) {
return succ;
}
sharedCache.addPartitionToCache(catName, dbName, tblName, part);
}
return succ;
}
代码示例来源:origin: apache/hive
public Object getFieldValue(_Fields field) {
switch (field) {
case VALUES:
return getValues();
case DB_NAME:
return getDbName();
case TABLE_NAME:
return getTableName();
case CREATE_TIME:
return getCreateTime();
case LAST_ACCESS_TIME:
return getLastAccessTime();
case SD:
return getSd();
case PARAMETERS:
return getParameters();
case PRIVILEGES:
return getPrivileges();
case CAT_NAME:
return getCatName();
case WRITE_ID:
return getWriteId();
case IS_STATS_COMPLIANT:
return isIsStatsCompliant();
case COL_STATS:
return getColStats();
}
throw new IllegalStateException();
}
代码示例来源:origin: apache/hive
@Override
public Partition add_partition_with_environment_context(
final Partition part, EnvironmentContext envContext)
throws InvalidObjectException, AlreadyExistsException,
MetaException {
if (part == null) {
throw new MetaException("Partition cannot be null.");
}
startTableFunction("add_partition",
part.getCatName(), part.getDbName(), part.getTableName());
Partition ret = null;
Exception ex = null;
try {
ret = add_partition_core(getMS(), part, envContext);
} catch (MetaException | InvalidObjectException | AlreadyExistsException e) {
ex = e;
throw e;
} catch (Exception e) {
ex = e;
throw newMetaException(e);
} finally {
endFunction("add_partition", ret != null, ex, part != null ? part.getTableName(): null);
}
return ret;
}
代码示例来源:origin: apache/hive
String catName = part.isSetCatName() ? part.getCatName() : getDefaultCatalog(conf);
MTable table = this.getMTable(catName, part.getDbName(), part.getTableName());
List<MTablePrivilege> tabGrants = null;
代码示例来源:origin: apache/hive
public PartitionWrapper(org.apache.hadoop.hive.metastore.api.Partition mapiPart,
PreEventContext context) throws HiveException, NoSuchObjectException, MetaException {
org.apache.hadoop.hive.metastore.api.Partition wrapperApiPart = mapiPart.deepCopy();
String catName = mapiPart.isSetCatName() ? mapiPart.getCatName() :
MetaStoreUtils.getDefaultCatalog(context.getHandler().getConf());
org.apache.hadoop.hive.metastore.api.Table t = context.getHandler().get_table_core(
catName, mapiPart.getDbName(), mapiPart.getTableName());
if (wrapperApiPart.getSd() == null){
// In the cases of create partition, by the time this event fires, the partition
// object has not yet come into existence, and thus will not yet have a
// location or an SD, but these are needed to create a ql.metadata.Partition,
// so we use the table's SD. The only place this is used is by the
// authorization hooks, so we will not affect code flow in the metastore itself.
wrapperApiPart.setSd(t.getSd().deepCopy());
}
initialize(new TableWrapper(t),wrapperApiPart);
}
}
代码示例来源:origin: apache/hive
Assert.assertEquals(expectedCatalog(), fetched.getCatName());
Assert.assertEquals("a0", fetched.getValues().get(0));
Assert.assertEquals(expectedCatalog(), fetched.getCatName());
Assert.assertEquals("a0", fetched.getValues().get(0));
代码示例来源:origin: apache/hive
Assert.assertEquals(catName, fetched.getCatName());
Assert.assertEquals("a0", fetched.getValues().get(0));
Assert.assertEquals(catName, fetched.getCatName());
Assert.assertEquals("a0", fetched.getValues().get(0));
代码示例来源:origin: apache/hive
/**
* @param partitionEvent partition event
* @throws MetaException
*/
@Override
public void onAlterPartition(AlterPartitionEvent partitionEvent) throws MetaException {
Partition before = partitionEvent.getOldPartition();
Partition after = partitionEvent.getNewPartition();
AlterPartitionMessage msg = MessageBuilder.getInstance()
.buildAlterPartitionMessage(partitionEvent.getTable(), before, after,
partitionEvent.getIsTruncateOp(),
partitionEvent.getWriteId());
NotificationEvent event =
new NotificationEvent(0, now(), EventType.ALTER_PARTITION.toString(),
msgEncoder.getSerializer().serialize(msg));
event.setCatName(before.isSetCatName() ? before.getCatName() : DEFAULT_CATALOG_NAME);
event.setDbName(before.getDbName());
event.setTableName(before.getTableName());
process(event, partitionEvent);
}
代码示例来源:origin: apache/hive
Assert.assertEquals(expectedCatalog(), fetched.get(0).getCatName());
Assert.assertEquals(expectedCatalog(), fetched.get(0).getCatName());
Assert.assertEquals(expectedCatalog(), fetched.get(0).getCatName());
代码示例来源:origin: apache/hive
Assert.assertEquals(catName, fetched.get(0).getCatName());
Assert.assertEquals(catName, fetched.get(0).getCatName());
Assert.assertEquals(catName, fetched.get(0).getCatName());
代码示例来源:origin: apache/hive
private void verifyAndUnsetColStats(String tblName, String partName, List<String> cols,
IMetaStoreClient msClient) throws Exception {
Partition part = msClient.getPartition(ss.getCurrentDatabase(), tblName, partName);
verifyAndUnsetColStatsVal(part.getParameters(), cols);
EnvironmentContext ec = new EnvironmentContext();
// Make sure metastore doesn't mess with our bogus stats updates.
ec.putToProperties(StatsSetupConst.DO_NOT_UPDATE_STATS, StatsSetupConst.TRUE);
msClient.alter_partition(part.getCatName(), part.getDbName(), tblName, part, ec);
// Double-check.
part = msClient.getPartition(ss.getCurrentDatabase(), tblName, partName);
for (String col : cols) {
assertFalse(StatsSetupConst.areColumnStatsUptoDate(part.getParameters(), col));
}
}
代码示例来源:origin: apache/hive
Assert.assertEquals(dbName, fetched.getDbName());
Assert.assertEquals(tableName, fetched.getTableName());
Assert.assertEquals(expectedCatalog(), fetched.getCatName());
代码示例来源:origin: apache/hive
Partition fetched = client.getPartition(catName, dbName, tableName,
Collections.singletonList("a" + i));
Assert.assertEquals(catName, fetched.getCatName());
Assert.assertEquals(dbName, fetched.getDbName());
Assert.assertEquals(tableName, fetched.getTableName());
内容来源于网络,如有侵权,请联系作者删除!