org.apache.hadoop.hive.ql.metadata.Table.getTableType()方法的使用及代码示例

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

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

Table.getTableType介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-gobblin

  1. private boolean canCopyTable() {
  2. if (!COPYABLE_TABLES.contains(this.table.getTableType())) {
  3. log.warn(String.format("Not copying %s: tables of type %s are not copyable.", this.table.getCompleteName(),
  4. this.table.getTableType()));
  5. return false;
  6. }
  7. return true;
  8. }
  9. }

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

  1. private static boolean isLockableTable(Table t) {
  2. if (t.isTemporary()) {
  3. return false;
  4. }
  5. switch (t.getTableType()) {
  6. case MANAGED_TABLE:
  7. case MATERIALIZED_VIEW:
  8. return true;
  9. default:
  10. return false;
  11. }
  12. }

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

  1. /**
  2. * @return whether this table is actually a view
  3. */
  4. public boolean isView() {
  5. return TableType.VIRTUAL_VIEW.equals(getTableType());
  6. }

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

  1. /**
  2. * @return whether this table is actually an index table
  3. */
  4. public boolean isIndexTable() {
  5. return TableType.INDEX_TABLE.equals(getTableType());
  6. }

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

  1. public boolean isMaterializedView() {
  2. return TableType.MATERIALIZED_VIEW.equals(getTableType());
  3. }

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

  1. /**
  2. * @return whether this table is actually a view
  3. */
  4. public boolean isView() {
  5. return TableType.VIRTUAL_VIEW.equals(getTableType());
  6. }

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

  1. public boolean isMaterializedView() {
  2. return TableType.MATERIALIZED_VIEW.equals(getTableType());
  3. }

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

  1. /**
  2. * Assert it supports Acid write.
  3. */
  4. protected void validateTargetTable(Table mTable) throws SemanticException {
  5. if (mTable.getTableType() == TableType.VIRTUAL_VIEW || mTable.getTableType() == TableType.MATERIALIZED_VIEW) {
  6. LOG.error("Table " + mTable.getFullyQualifiedName() + " is a view or materialized view");
  7. throw new SemanticException(ErrorMsg.UPDATE_DELETE_VIEW.getMsg());
  8. }
  9. }

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

  1. public static String getPartitionInformation(Partition part) {
  2. StringBuilder tableInfo = new StringBuilder(DEFAULT_STRINGBUILDER_SIZE);
  3. // Table Metadata
  4. tableInfo.append(LINE_DELIM).append("# Detailed Partition Information").append(LINE_DELIM);
  5. getPartitionMetaDataInformation(tableInfo, part);
  6. // Storage information.
  7. if (part.getTable().getTableType() != TableType.VIRTUAL_VIEW) {
  8. tableInfo.append(LINE_DELIM).append("# Storage Information").append(LINE_DELIM);
  9. getStorageDescriptorInfo(tableInfo, part.getTPartition().getSd());
  10. }
  11. return tableInfo.toString();
  12. }

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

  1. public static String getPartitionInformation(Partition part) {
  2. StringBuilder tableInfo = new StringBuilder(DEFAULT_STRINGBUILDER_SIZE);
  3. // Table Metadata
  4. tableInfo.append(LINE_DELIM).append("# Detailed Partition Information").append(LINE_DELIM);
  5. getPartitionMetaDataInformation(tableInfo, part);
  6. // Storage information.
  7. if (part.getTable().getTableType() != TableType.VIRTUAL_VIEW) {
  8. tableInfo.append(LINE_DELIM).append("# Storage Information").append(LINE_DELIM);
  9. getStorageDescriptorInfo(tableInfo, part.getTPartition().getSd());
  10. }
  11. return tableInfo.toString();
  12. }

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

  1. private Task<?> dropTableTask(Table table) {
  2. assert(table != null);
  3. DropTableDesc dropTblDesc = new DropTableDesc(table.getFullyQualifiedName(), table.getTableType(),
  4. true, false, event.replicationSpec());
  5. return TaskFactory.get(new DDLWork(new HashSet<>(), new HashSet<>(), dropTblDesc), context.hiveConf);
  6. }
  7. }

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

  1. /**
  2. * Assert it supports Acid write
  3. */
  4. private void validateTargetTable(Table mTable) throws SemanticException {
  5. if (mTable.getTableType() == TableType.VIRTUAL_VIEW ||
  6. mTable.getTableType() == TableType.MATERIALIZED_VIEW) {
  7. LOG.error("Table " + getDotName(new String[] {mTable.getDbName(), mTable.getTableName()}) + " is a view or materialized view");
  8. throw new SemanticException(ErrorMsg.UPDATE_DELETE_VIEW.getMsg());
  9. }
  10. }
  11. /**

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

  1. private void checkExternalTable(Table dest_tab) throws SemanticException {
  2. if ((!conf.getBoolVar(HiveConf.ConfVars.HIVE_INSERT_INTO_EXTERNAL_TABLES)) &&
  3. (dest_tab.getTableType().equals(TableType.EXTERNAL_TABLE))) {
  4. throw new SemanticException(
  5. ErrorMsg.INSERT_EXTERNAL_TABLE.getMsg(dest_tab.getTableName()));
  6. }
  7. }

代码示例来源:origin: apache/incubator-gobblin

  1. /**
  2. * Automatically serializes the {@link HiveDataset} by calling {@link #setHiveDataset(HiveDataset)}
  3. * @param hiveDataset for which the workunit is being created
  4. */
  5. @SuppressWarnings("deprecation")
  6. public HiveWorkUnit(HiveDataset hiveDataset) {
  7. super();
  8. setHiveDataset(hiveDataset);
  9. if (hiveDataset.getTable().getTableType() != TableType.VIRTUAL_VIEW) {
  10. setTableLocation(hiveDataset.getTable().getSd().getLocation());
  11. }
  12. }

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

  1. private static Task<?> dropTableTask(Table table, EximUtil.SemanticAnalyzerWrapperContext x,
  2. ReplicationSpec replicationSpec) {
  3. DropTableDesc dropTblDesc = new DropTableDesc(table.getTableName(), table.getTableType(),
  4. true, false, replicationSpec);
  5. return TaskFactory.get(new DDLWork(x.getInputs(), x.getOutputs(), dropTblDesc), x.getConf());
  6. }

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

  1. private void analyzeShowCreateTable(ASTNode ast) throws SemanticException {
  2. ShowCreateTableDesc showCreateTblDesc;
  3. String tableName = getUnescapedName((ASTNode)ast.getChild(0));
  4. showCreateTblDesc = new ShowCreateTableDesc(tableName, ctx.getResFile().toString());
  5. Table tab = getTable(tableName);
  6. if (tab.getTableType() == org.apache.hadoop.hive.metastore.TableType.INDEX_TABLE) {
  7. throw new SemanticException(ErrorMsg.SHOW_CREATETABLE_INDEX.getMsg(tableName
  8. + " has table type INDEX_TABLE"));
  9. }
  10. inputs.add(new ReadEntity(tab));
  11. rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(),
  12. showCreateTblDesc), conf));
  13. setFetchTask(createFetchTask(showCreateTblDesc.getSchema()));
  14. }

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

  1. private static void getTableMetaDataInformation(StringBuilder tableInfo, Table tbl,
  2. boolean isOutputPadded) {
  3. formatOutput("Database:", tbl.getDbName(), tableInfo);
  4. formatOutput("Owner:", tbl.getOwner(), tableInfo);
  5. formatOutput("CreateTime:", formatDate(tbl.getTTable().getCreateTime()), tableInfo);
  6. formatOutput("LastAccessTime:", formatDate(tbl.getTTable().getLastAccessTime()), tableInfo);
  7. formatOutput("Retention:", Integer.toString(tbl.getRetention()), tableInfo);
  8. if (!tbl.isView()) {
  9. formatOutput("Location:", tbl.getDataLocation().toString(), tableInfo);
  10. }
  11. formatOutput("Table Type:", tbl.getTableType().name(), tableInfo);
  12. if (tbl.getParameters().size() > 0) {
  13. tableInfo.append("Table Parameters:").append(LINE_DELIM);
  14. displayAllParameters(tbl.getParameters(), tableInfo, false, isOutputPadded);
  15. }
  16. }

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

  1. private static void getTableMetaDataInformation(StringBuilder tableInfo, Table tbl,
  2. boolean isOutputPadded) {
  3. formatOutput("Database:", tbl.getDbName(), tableInfo);
  4. formatOutput("OwnerType:", (tbl.getOwnerType() != null) ? tbl.getOwnerType().name() : "null", tableInfo);
  5. formatOutput("Owner:", tbl.getOwner(), tableInfo);
  6. formatOutput("CreateTime:", formatDate(tbl.getTTable().getCreateTime()), tableInfo);
  7. formatOutput("LastAccessTime:", formatDate(tbl.getTTable().getLastAccessTime()), tableInfo);
  8. formatOutput("Retention:", Integer.toString(tbl.getRetention()), tableInfo);
  9. if (!tbl.isView()) {
  10. formatOutput("Location:", tbl.getDataLocation().toString(), tableInfo);
  11. }
  12. formatOutput("Table Type:", tbl.getTableType().name(), tableInfo);
  13. if (tbl.getParameters().size() > 0) {
  14. tableInfo.append("Table Parameters:").append(LINE_DELIM);
  15. displayAllParameters(tbl.getParameters(), tableInfo, false, isOutputPadded);
  16. }
  17. }

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

  1. @Override
  2. public RelNode visit(TableScan scan) {
  3. if (scan instanceof HiveTableScan) {
  4. HiveTableScan hiveScan = (HiveTableScan) scan;
  5. RelOptHiveTable relOptHiveTable = (RelOptHiveTable) hiveScan.getTable();
  6. Table tab = relOptHiveTable.getHiveTableMD();
  7. if (tab.isTemporary()) {
  8. fail(tab.getTableName() + " is a temporary table");
  9. }
  10. if (tab.getTableType() == TableType.EXTERNAL_TABLE) {
  11. fail(tab.getFullyQualifiedName() + " is an external table");
  12. }
  13. return scan;
  14. }
  15. // TableScan of a non-Hive table - don't support for materializations.
  16. fail(scan.getTable().getQualifiedName() + " is a table scan of a non-Hive table.");
  17. return scan;
  18. }

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

  1. void dumpTable(String dbName, String tblName, String validTxnList, Path dbRoot, long lastReplId,
  2. Hive hiveDb, HiveWrapper.Tuple<Table> tuple) throws Exception {
  3. TableSpec tableSpec = new TableSpec(tuple.object);
  4. TableExport.Paths exportPaths =
  5. new TableExport.Paths(work.astRepresentationForErrorMsg, dbRoot, tblName, conf, true);
  6. String distCpDoAsUser = conf.getVar(HiveConf.ConfVars.HIVE_DISTCP_DOAS_USER);
  7. tuple.replicationSpec.setIsReplace(true); // by default for all other objects this is false
  8. if (AcidUtils.isTransactionalTable(tableSpec.tableHandle)) {
  9. tuple.replicationSpec.setValidTxnList(validTxnList);
  10. tuple.replicationSpec.setValidWriteIdList(getValidWriteIdList(dbName, tblName, validTxnList));
  11. // For transactional table, data would be valid snapshot for current txn and doesn't include data
  12. // added/modified by concurrent txns which are later than current txn. So, need to set last repl Id of this table
  13. // as bootstrap dump's last repl Id.
  14. tuple.replicationSpec.setCurrentReplicationState(String.valueOf(lastReplId));
  15. // For now we do not replicate stats for ACID table. So, wipe out column stats if any.
  16. tableSpec.tableHandle.getTTable().unsetColStats();
  17. }
  18. MmContext mmCtx = MmContext.createIfNeeded(tableSpec.tableHandle);
  19. new TableExport(
  20. exportPaths, tableSpec, tuple.replicationSpec, hiveDb, distCpDoAsUser, conf, mmCtx).write();
  21. replLogger.tableLog(tblName, tableSpec.tableHandle.getTableType());
  22. }

相关文章

Table类方法