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

x33g5p2x  于2022-01-29 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(95)

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

Table.isSetCatName介绍

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

代码示例

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

private String getTableCatalog(Table table) {
 String catName = table.isSetCatName() ? table.getCatName() :
  MetaStoreUtils.getDefaultCatalog(getConf());
 return catName.toLowerCase();
}

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

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

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

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

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

/**
 * Gets partitions by using direct SQL queries.
 * @param filter The filter.
 * @param max The maximum number of partitions to return.
 * @return List of partitions.
 */
public List<Partition> getPartitionsViaSqlFilter(
  SqlFilterForPushdown filter, Integer max) throws MetaException {
 Boolean isViewTable = isViewTable(filter.table);
 String catName = filter.table.isSetCatName() ? filter.table.getCatName() :
   DEFAULT_CATALOG_NAME;
 List<Long> partitionIds = getPartitionIdsViaSqlFilter(catName,
   filter.table.getDbName(), filter.table.getTableName(), filter.filter, filter.params,
   filter.joins, max);
 if (partitionIds.isEmpty()) {
  return Collections.emptyList(); // no partitions, bail early.
 }
 return Batchable.runBatched(batchSize, partitionIds, new Batchable<Long, Partition>() {
  @Override
  public List<Partition> run(List<Long> input) throws MetaException {
   return getPartitionsFromPartitionIds(catName, filter.table.getDbName(),
     filter.table.getTableName(), isViewTable, input, Collections.emptyList());
  }
 });
}

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

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

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

MetaException, NoSuchObjectException, TException {
if (!tbl.isSetCatName()) {
 String defaultCat = getDefaultCatalog(conf);
 tbl.setCatName(defaultCat);

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

public void createTable(Table tbl, EnvironmentContext envContext) throws AlreadyExistsException,
  InvalidObjectException, MetaException, NoSuchObjectException, TException {
 if (!tbl.isSetCatName()) {
  tbl.setCatName(getDefaultCatalog(conf));
 }
 HiveMetaHook hook = getHook(tbl);
 if (hook != null) {
  hook.preCreateTable(tbl);
 }
 boolean success = false;
 try {
  // Subclasses can override this step (for example, for temporary tables)
  create_table_with_environment_context(tbl, envContext);
  if (hook != null) {
   hook.commitCreateTable(tbl);
  }
  success = true;
 }
 finally {
  if (!success && (hook != null)) {
   try {
    hook.rollbackCreateTable(tbl);
   } catch (Exception e){
    LOG.error("Create rollback failed with", e);
   }
  }
 }
}

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

params[i++] = table.getTableName();
params[i++] = table.getDbName();
params[i++] = table.isSetCatName() ? table.getCatName() : getDefaultCatalog(conf);
int firstI = i;
for (String s : partNames) {

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

EnvironmentContext ec, String validWriteIds, Configuration conf, List<String> deletedCols)
 throws MetaException, InvalidObjectException {
String catName = normalizeIdentifier(oldTable.isSetCatName() ? oldTable.getCatName() :
  getDefaultCatalog(conf));
String dbName = oldTable.getDbName().toLowerCase();

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

this.creationMetadata = other.creationMetadata;
if (other.isSetCatName()) {
 this.catName = other.catName;

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

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

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

String catName = tbl.isSetCatName() ? tbl.getCatName() : getDefaultCatalog(conf);
try {
 mdb = getMDatabase(catName, tbl.getDbName());

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

/**
 * @param tableEvent table event.
 * @throws MetaException
 */
@Override
public void onDropTable(DropTableEvent tableEvent) throws MetaException {
 Table t = tableEvent.getTable();
 DropTableMessage msg = MessageBuilder.getInstance().buildDropTableMessage(t);
 NotificationEvent event =
   new NotificationEvent(0, now(), EventType.DROP_TABLE.toString(),
     msgEncoder.getSerializer().serialize(msg));
 event.setCatName(t.isSetCatName() ? t.getCatName() : DEFAULT_CATALOG_NAME);
 event.setDbName(t.getDbName());
 event.setTableName(t.getTableName());
 process(event, tableEvent);
}

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

return isSetCreationMetadata();
case CAT_NAME:
 return isSetCatName();
case OWNER_TYPE:
 return isSetOwnerType();

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

/**
 * @param partitionEvent partition event
 * @throws MetaException
 */
@Override
public void onDropPartition(DropPartitionEvent partitionEvent) throws MetaException {
 Table t = partitionEvent.getTable();
 DropPartitionMessage msg =
   MessageBuilder.getInstance()
     .buildDropPartitionMessage(t, partitionEvent.getPartitionIterator());
 NotificationEvent event = new NotificationEvent(0, now(), EventType.DROP_PARTITION.toString(),
   msgEncoder.getSerializer().serialize(msg));
 event.setCatName(t.isSetCatName() ? t.getCatName() : DEFAULT_CATALOG_NAME);
 event.setDbName(t.getDbName());
 event.setTableName(t.getTableName());
 process(event, partitionEvent);
}

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

@Override
public List<String> createTableWithConstraints(Table tbl, List<SQLPrimaryKey> primaryKeys,
  List<SQLForeignKey> foreignKeys, List<SQLUniqueConstraint> uniqueConstraints,
  List<SQLNotNullConstraint> notNullConstraints,
  List<SQLDefaultConstraint> defaultConstraints,
  List<SQLCheckConstraint> checkConstraints) throws InvalidObjectException, MetaException {
 // TODO constraintCache
 List<String> constraintNames = rawStore.createTableWithConstraints(tbl, primaryKeys,
   foreignKeys, uniqueConstraints, notNullConstraints, defaultConstraints, checkConstraints);
 // in case of event based cache update, cache is updated during commit.
 if (canUseEvents) {
  return constraintNames;
 }
 String dbName = normalizeIdentifier(tbl.getDbName());
 String tblName = normalizeIdentifier(tbl.getTableName());
 String catName = tbl.isSetCatName() ? normalizeIdentifier(tbl.getCatName()) :
   DEFAULT_CATALOG_NAME;
 if (!shouldCacheTable(catName, dbName, tblName)) {
  return constraintNames;
 }
 sharedCache.addTableToCache(StringUtils.normalizeIdentifier(tbl.getCatName()),
   StringUtils.normalizeIdentifier(tbl.getDbName()),
   StringUtils.normalizeIdentifier(tbl.getTableName()), tbl);
 return constraintNames;
}

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

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

/**
 * @param tableEvent alter table event
 * @throws MetaException
 */
@Override
public void onAlterTable(AlterTableEvent tableEvent) throws MetaException {
 Table before = tableEvent.getOldTable();
 Table after = tableEvent.getNewTable();
 AlterTableMessage msg = MessageBuilder.getInstance()
   .buildAlterTableMessage(before, after, tableEvent.getIsTruncateOp(),
     tableEvent.getWriteId());
 NotificationEvent event =
   new NotificationEvent(0, now(), EventType.ALTER_TABLE.toString(),
     msgEncoder.getSerializer().serialize(msg)
   );
 event.setCatName(after.isSetCatName() ? after.getCatName() : DEFAULT_CATALOG_NAME);
 event.setDbName(after.getDbName());
 event.setTableName(after.getTableName());
 process(event, tableEvent);
}

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

/**
 * @param partitionEvent partition event
 * @throws MetaException
 */
@Override
public void onAddPartition(AddPartitionEvent partitionEvent) throws MetaException {
 Table t = partitionEvent.getTable();
 PartitionFilesIterator fileIter = MetaStoreUtils.isExternalTable(t)
     ? null : new PartitionFilesIterator(partitionEvent.getPartitionIterator(), t);
 EventMessage msg = MessageBuilder.getInstance()
   .buildAddPartitionMessage(t, partitionEvent.getPartitionIterator(), fileIter);
 MessageSerializer serializer = msgEncoder.getSerializer();
 NotificationEvent event = new NotificationEvent(0, now(),
   EventType.ADD_PARTITION.toString(), serializer.serialize(msg));
 event.setCatName(t.isSetCatName() ? t.getCatName() : DEFAULT_CATALOG_NAME);
 event.setDbName(t.getDbName());
 event.setTableName(t.getTableName());
 process(event, partitionEvent);
}

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

/**
 * @param tableEvent table event.
 * @throws MetaException
 */
@Override
public void onCreateTable(CreateTableEvent tableEvent) throws MetaException {
 Table t = tableEvent.getTable();
 FileIterator fileIter = MetaStoreUtils.isExternalTable(t)
              ? null : new FileIterator(t.getSd().getLocation());
 CreateTableMessage msg =
   MessageBuilder.getInstance().buildCreateTableMessage(t, fileIter);
 NotificationEvent event =
   new NotificationEvent(0, now(), EventType.CREATE_TABLE.toString(),
     msgEncoder.getSerializer().serialize(msg));
 event.setCatName(t.isSetCatName() ? t.getCatName() : DEFAULT_CATALOG_NAME);
 event.setDbName(t.getDbName());
 event.setTableName(t.getTableName());
 process(event, tableEvent);
}

相关文章

Table类方法