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

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

本文整理了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

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

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

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

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

  1. list.add(creationMetadata);
  2. boolean present_catName = true && (isSetCatName());
  3. list.add(present_catName);
  4. if (present_catName)

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

  1. /**
  2. * Gets partitions by using direct SQL queries.
  3. * @param filter The filter.
  4. * @param max The maximum number of partitions to return.
  5. * @return List of partitions.
  6. */
  7. public List<Partition> getPartitionsViaSqlFilter(
  8. SqlFilterForPushdown filter, Integer max) throws MetaException {
  9. Boolean isViewTable = isViewTable(filter.table);
  10. String catName = filter.table.isSetCatName() ? filter.table.getCatName() :
  11. DEFAULT_CATALOG_NAME;
  12. List<Long> partitionIds = getPartitionIdsViaSqlFilter(catName,
  13. filter.table.getDbName(), filter.table.getTableName(), filter.filter, filter.params,
  14. filter.joins, max);
  15. if (partitionIds.isEmpty()) {
  16. return Collections.emptyList(); // no partitions, bail early.
  17. }
  18. return Batchable.runBatched(batchSize, partitionIds, new Batchable<Long, Partition>() {
  19. @Override
  20. public List<Partition> run(List<Long> input) throws MetaException {
  21. return getPartitionsFromPartitionIds(catName, filter.table.getDbName(),
  22. filter.table.getTableName(), isViewTable, input, Collections.emptyList());
  23. }
  24. });
  25. }

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

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

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

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

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

  1. public void createTable(Table tbl, EnvironmentContext envContext) throws AlreadyExistsException,
  2. InvalidObjectException, MetaException, NoSuchObjectException, TException {
  3. if (!tbl.isSetCatName()) {
  4. tbl.setCatName(getDefaultCatalog(conf));
  5. }
  6. HiveMetaHook hook = getHook(tbl);
  7. if (hook != null) {
  8. hook.preCreateTable(tbl);
  9. }
  10. boolean success = false;
  11. try {
  12. // Subclasses can override this step (for example, for temporary tables)
  13. create_table_with_environment_context(tbl, envContext);
  14. if (hook != null) {
  15. hook.commitCreateTable(tbl);
  16. }
  17. success = true;
  18. }
  19. finally {
  20. if (!success && (hook != null)) {
  21. try {
  22. hook.rollbackCreateTable(tbl);
  23. } catch (Exception e){
  24. LOG.error("Create rollback failed with", e);
  25. }
  26. }
  27. }
  28. }

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

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

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

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

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

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

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

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

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

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

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

  1. /**
  2. * @param tableEvent table event.
  3. * @throws MetaException
  4. */
  5. @Override
  6. public void onDropTable(DropTableEvent tableEvent) throws MetaException {
  7. Table t = tableEvent.getTable();
  8. DropTableMessage msg = MessageBuilder.getInstance().buildDropTableMessage(t);
  9. NotificationEvent event =
  10. new NotificationEvent(0, now(), EventType.DROP_TABLE.toString(),
  11. msgEncoder.getSerializer().serialize(msg));
  12. event.setCatName(t.isSetCatName() ? t.getCatName() : DEFAULT_CATALOG_NAME);
  13. event.setDbName(t.getDbName());
  14. event.setTableName(t.getTableName());
  15. process(event, tableEvent);
  16. }

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

  1. return isSetCreationMetadata();
  2. case CAT_NAME:
  3. return isSetCatName();
  4. case OWNER_TYPE:
  5. return isSetOwnerType();

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

  1. /**
  2. * @param partitionEvent partition event
  3. * @throws MetaException
  4. */
  5. @Override
  6. public void onDropPartition(DropPartitionEvent partitionEvent) throws MetaException {
  7. Table t = partitionEvent.getTable();
  8. DropPartitionMessage msg =
  9. MessageBuilder.getInstance()
  10. .buildDropPartitionMessage(t, partitionEvent.getPartitionIterator());
  11. NotificationEvent event = new NotificationEvent(0, now(), EventType.DROP_PARTITION.toString(),
  12. msgEncoder.getSerializer().serialize(msg));
  13. event.setCatName(t.isSetCatName() ? t.getCatName() : DEFAULT_CATALOG_NAME);
  14. event.setDbName(t.getDbName());
  15. event.setTableName(t.getTableName());
  16. process(event, partitionEvent);
  17. }

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

  1. @Override
  2. public List<String> createTableWithConstraints(Table tbl, List<SQLPrimaryKey> primaryKeys,
  3. List<SQLForeignKey> foreignKeys, List<SQLUniqueConstraint> uniqueConstraints,
  4. List<SQLNotNullConstraint> notNullConstraints,
  5. List<SQLDefaultConstraint> defaultConstraints,
  6. List<SQLCheckConstraint> checkConstraints) throws InvalidObjectException, MetaException {
  7. // TODO constraintCache
  8. List<String> constraintNames = rawStore.createTableWithConstraints(tbl, primaryKeys,
  9. foreignKeys, uniqueConstraints, notNullConstraints, defaultConstraints, checkConstraints);
  10. // in case of event based cache update, cache is updated during commit.
  11. if (canUseEvents) {
  12. return constraintNames;
  13. }
  14. String dbName = normalizeIdentifier(tbl.getDbName());
  15. String tblName = normalizeIdentifier(tbl.getTableName());
  16. String catName = tbl.isSetCatName() ? normalizeIdentifier(tbl.getCatName()) :
  17. DEFAULT_CATALOG_NAME;
  18. if (!shouldCacheTable(catName, dbName, tblName)) {
  19. return constraintNames;
  20. }
  21. sharedCache.addTableToCache(StringUtils.normalizeIdentifier(tbl.getCatName()),
  22. StringUtils.normalizeIdentifier(tbl.getDbName()),
  23. StringUtils.normalizeIdentifier(tbl.getTableName()), tbl);
  24. return constraintNames;
  25. }

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

  1. @Override
  2. public void onInsert(InsertEvent insertEvent) throws MetaException {
  3. Table tableObj = insertEvent.getTableObj();
  4. InsertMessage msg = MessageBuilder.getInstance().buildInsertMessage(tableObj,
  5. insertEvent.getPartitionObj(), insertEvent.isReplace(),
  6. new FileChksumIterator(insertEvent.getFiles(), insertEvent.getFileChecksums()));
  7. NotificationEvent event =
  8. new NotificationEvent(0, now(), EventType.INSERT.toString(),
  9. msgEncoder.getSerializer().serialize(msg));
  10. event.setCatName(tableObj.isSetCatName() ? tableObj.getCatName() : DEFAULT_CATALOG_NAME);
  11. event.setDbName(tableObj.getDbName());
  12. event.setTableName(tableObj.getTableName());
  13. process(event, insertEvent);
  14. }

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

  1. /**
  2. * @param tableEvent alter table event
  3. * @throws MetaException
  4. */
  5. @Override
  6. public void onAlterTable(AlterTableEvent tableEvent) throws MetaException {
  7. Table before = tableEvent.getOldTable();
  8. Table after = tableEvent.getNewTable();
  9. AlterTableMessage msg = MessageBuilder.getInstance()
  10. .buildAlterTableMessage(before, after, tableEvent.getIsTruncateOp(),
  11. tableEvent.getWriteId());
  12. NotificationEvent event =
  13. new NotificationEvent(0, now(), EventType.ALTER_TABLE.toString(),
  14. msgEncoder.getSerializer().serialize(msg)
  15. );
  16. event.setCatName(after.isSetCatName() ? after.getCatName() : DEFAULT_CATALOG_NAME);
  17. event.setDbName(after.getDbName());
  18. event.setTableName(after.getTableName());
  19. process(event, tableEvent);
  20. }

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

  1. /**
  2. * @param partitionEvent partition event
  3. * @throws MetaException
  4. */
  5. @Override
  6. public void onAddPartition(AddPartitionEvent partitionEvent) throws MetaException {
  7. Table t = partitionEvent.getTable();
  8. PartitionFilesIterator fileIter = MetaStoreUtils.isExternalTable(t)
  9. ? null : new PartitionFilesIterator(partitionEvent.getPartitionIterator(), t);
  10. EventMessage msg = MessageBuilder.getInstance()
  11. .buildAddPartitionMessage(t, partitionEvent.getPartitionIterator(), fileIter);
  12. MessageSerializer serializer = msgEncoder.getSerializer();
  13. NotificationEvent event = new NotificationEvent(0, now(),
  14. EventType.ADD_PARTITION.toString(), serializer.serialize(msg));
  15. event.setCatName(t.isSetCatName() ? t.getCatName() : DEFAULT_CATALOG_NAME);
  16. event.setDbName(t.getDbName());
  17. event.setTableName(t.getTableName());
  18. process(event, partitionEvent);
  19. }

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

  1. /**
  2. * @param tableEvent table event.
  3. * @throws MetaException
  4. */
  5. @Override
  6. public void onCreateTable(CreateTableEvent tableEvent) throws MetaException {
  7. Table t = tableEvent.getTable();
  8. FileIterator fileIter = MetaStoreUtils.isExternalTable(t)
  9. ? null : new FileIterator(t.getSd().getLocation());
  10. CreateTableMessage msg =
  11. MessageBuilder.getInstance().buildCreateTableMessage(t, fileIter);
  12. NotificationEvent event =
  13. new NotificationEvent(0, now(), EventType.CREATE_TABLE.toString(),
  14. msgEncoder.getSerializer().serialize(msg));
  15. event.setCatName(t.isSetCatName() ? t.getCatName() : DEFAULT_CATALOG_NAME);
  16. event.setDbName(t.getDbName());
  17. event.setTableName(t.getTableName());
  18. process(event, tableEvent);
  19. }

相关文章

Table类方法