org.apache.hadoop.hive.metastore.api.Partition.isSetCatName()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(92)

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

Partition.isSetCatName介绍

[英]Returns true if field catName is set (has been assigned a value) and false otherwise
[中]如果设置了字段catName(已指定值),则返回true,否则返回false

代码示例

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

/**
 * @param new_parts
 * @throws InvalidObjectException
 * @throws AlreadyExistsException
 * @throws MetaException
 * @throws TException
 * @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#add_partitions(List)
 */
@Override
public int add_partitions(List<Partition> new_parts) throws TException {
 if (new_parts == null || new_parts.contains(null)) {
  throw new MetaException("Partitions cannot be null.");
 }
 if (new_parts != null && !new_parts.isEmpty() && !new_parts.get(0).isSetCatName()) {
  final String defaultCat = getDefaultCatalog(conf);
  new_parts.forEach(p -> p.setCatName(defaultCat));
 }
 return client.add_partitions(new_parts);
}

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

if (isSetCatName()) {
 if (!first) sb.append(", ");
 sb.append("catName:");

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

list.add(privileges);
boolean present_catName = true && (isSetCatName());
list.add(present_catName);
if (present_catName)

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

public Partition add_partition(Partition new_part, EnvironmentContext envContext)
  throws TException {
 if (new_part != null && !new_part.isSetCatName()) {
  new_part.setCatName(getDefaultCatalog(conf));
 }
 Partition p = client.add_partition_with_environment_context(new_part, envContext);
 return deepCopy(p);
}

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

if (struct.isSetCatName()) {
 oprot.writeFieldBegin(CAT_NAME_FIELD_DESC);
 oprot.writeString(struct.catName);

代码示例来源: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

try {
 if (!parts.get(0).isSetCatName()) {
  String defaultCat = getDefaultCatalog(conf);
  for (Partition p : parts) {

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

lastComparison = Boolean.valueOf(isSetCatName()).compareTo(other.isSetCatName());
if (lastComparison != 0) {
 return lastComparison;
if (isSetCatName()) {
 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.catName, other.catName);
 if (lastComparison != 0) {

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

optionals.set(7);
if (struct.isSetCatName()) {
 optionals.set(8);
 struct.privileges.write(oprot);
if (struct.isSetCatName()) {
 oprot.writeString(struct.catName);

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

return isSetPrivileges();
case CAT_NAME:
 return isSetCatName();
case WRITE_ID:
 return isSetWriteId();

代码示例来源: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

this.privileges = new PrincipalPrivilegeSet(other.privileges);
if (other.isSetCatName()) {
 this.catName = org.apache.hadoop.hive.metastore.utils.StringUtils.intern(other.catName);

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

if (!new_part.isSetCatName()) {
 new_part.setCatName(catName);

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

boolean this_present_catName = true && this.isSetCatName();
boolean that_present_catName = true && that.isSetCatName();
if (this_present_catName || that_present_catName) {
 if (!(this_present_catName && that_present_catName))

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

for (Partition tmpPart : new_parts) {
 if (!tmpPart.isSetCatName()) {
  tmpPart.setCatName(getDefaultCatalog(conf));

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

@Override
public AddPartitionsResult add_partitions_req(AddPartitionsRequest request)
  throws TException {
 AddPartitionsResult result = new AddPartitionsResult();
 if (request.getParts().isEmpty()) {
  return result;
 }
 try {
  if (!request.isSetCatName()) {
   request.setCatName(getDefaultCatalog(conf));
  }
  // Make sure all of the partitions have the catalog set as well
  request.getParts().forEach(p -> {
   if (!p.isSetCatName()) {
    p.setCatName(getDefaultCatalog(conf));
   }
  });
  List<Partition> parts = add_partitions_core(getMS(), request.getCatName(), request.getDbName(),
    request.getTblName(), request.getParts(), request.isIfNotExists());
  if (request.isNeedResult()) {
   result.setPartitions(parts);
  }
 } catch (TException te) {
  throw te;
 } catch (Exception e) {
  throw newMetaException(e);
 }
 return result;
}

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

Table tbl = null;
Map<String, String> transactionalListenerResponses = Collections.emptyMap();
if (!part.isSetCatName()) {
 part.setCatName(getDefaultCatalog(conf));

代码示例来源: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

/**
 * @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);
}

相关文章

微信公众号

最新文章

更多

Partition类方法