本文整理了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
暂无
代码示例来源:origin: apache/incubator-gobblin
private boolean canCopyTable() {
if (!COPYABLE_TABLES.contains(this.table.getTableType())) {
log.warn(String.format("Not copying %s: tables of type %s are not copyable.", this.table.getCompleteName(),
this.table.getTableType()));
return false;
}
return true;
}
}
代码示例来源:origin: apache/hive
private static boolean isLockableTable(Table t) {
if (t.isTemporary()) {
return false;
}
switch (t.getTableType()) {
case MANAGED_TABLE:
case MATERIALIZED_VIEW:
return true;
default:
return false;
}
}
代码示例来源:origin: apache/hive
/**
* @return whether this table is actually a view
*/
public boolean isView() {
return TableType.VIRTUAL_VIEW.equals(getTableType());
}
代码示例来源:origin: apache/drill
/**
* @return whether this table is actually an index table
*/
public boolean isIndexTable() {
return TableType.INDEX_TABLE.equals(getTableType());
}
代码示例来源:origin: apache/hive
public boolean isMaterializedView() {
return TableType.MATERIALIZED_VIEW.equals(getTableType());
}
代码示例来源:origin: apache/drill
/**
* @return whether this table is actually a view
*/
public boolean isView() {
return TableType.VIRTUAL_VIEW.equals(getTableType());
}
代码示例来源:origin: apache/drill
public boolean isMaterializedView() {
return TableType.MATERIALIZED_VIEW.equals(getTableType());
}
代码示例来源:origin: apache/hive
/**
* Assert it supports Acid write.
*/
protected void validateTargetTable(Table mTable) throws SemanticException {
if (mTable.getTableType() == TableType.VIRTUAL_VIEW || mTable.getTableType() == TableType.MATERIALIZED_VIEW) {
LOG.error("Table " + mTable.getFullyQualifiedName() + " is a view or materialized view");
throw new SemanticException(ErrorMsg.UPDATE_DELETE_VIEW.getMsg());
}
}
代码示例来源:origin: apache/hive
public static String getPartitionInformation(Partition part) {
StringBuilder tableInfo = new StringBuilder(DEFAULT_STRINGBUILDER_SIZE);
// Table Metadata
tableInfo.append(LINE_DELIM).append("# Detailed Partition Information").append(LINE_DELIM);
getPartitionMetaDataInformation(tableInfo, part);
// Storage information.
if (part.getTable().getTableType() != TableType.VIRTUAL_VIEW) {
tableInfo.append(LINE_DELIM).append("# Storage Information").append(LINE_DELIM);
getStorageDescriptorInfo(tableInfo, part.getTPartition().getSd());
}
return tableInfo.toString();
}
代码示例来源:origin: apache/drill
public static String getPartitionInformation(Partition part) {
StringBuilder tableInfo = new StringBuilder(DEFAULT_STRINGBUILDER_SIZE);
// Table Metadata
tableInfo.append(LINE_DELIM).append("# Detailed Partition Information").append(LINE_DELIM);
getPartitionMetaDataInformation(tableInfo, part);
// Storage information.
if (part.getTable().getTableType() != TableType.VIRTUAL_VIEW) {
tableInfo.append(LINE_DELIM).append("# Storage Information").append(LINE_DELIM);
getStorageDescriptorInfo(tableInfo, part.getTPartition().getSd());
}
return tableInfo.toString();
}
代码示例来源:origin: apache/hive
private Task<?> dropTableTask(Table table) {
assert(table != null);
DropTableDesc dropTblDesc = new DropTableDesc(table.getFullyQualifiedName(), table.getTableType(),
true, false, event.replicationSpec());
return TaskFactory.get(new DDLWork(new HashSet<>(), new HashSet<>(), dropTblDesc), context.hiveConf);
}
}
代码示例来源:origin: apache/drill
/**
* Assert it supports Acid write
*/
private void validateTargetTable(Table mTable) throws SemanticException {
if (mTable.getTableType() == TableType.VIRTUAL_VIEW ||
mTable.getTableType() == TableType.MATERIALIZED_VIEW) {
LOG.error("Table " + getDotName(new String[] {mTable.getDbName(), mTable.getTableName()}) + " is a view or materialized view");
throw new SemanticException(ErrorMsg.UPDATE_DELETE_VIEW.getMsg());
}
}
/**
代码示例来源:origin: apache/hive
private void checkExternalTable(Table dest_tab) throws SemanticException {
if ((!conf.getBoolVar(HiveConf.ConfVars.HIVE_INSERT_INTO_EXTERNAL_TABLES)) &&
(dest_tab.getTableType().equals(TableType.EXTERNAL_TABLE))) {
throw new SemanticException(
ErrorMsg.INSERT_EXTERNAL_TABLE.getMsg(dest_tab.getTableName()));
}
}
代码示例来源:origin: apache/incubator-gobblin
/**
* Automatically serializes the {@link HiveDataset} by calling {@link #setHiveDataset(HiveDataset)}
* @param hiveDataset for which the workunit is being created
*/
@SuppressWarnings("deprecation")
public HiveWorkUnit(HiveDataset hiveDataset) {
super();
setHiveDataset(hiveDataset);
if (hiveDataset.getTable().getTableType() != TableType.VIRTUAL_VIEW) {
setTableLocation(hiveDataset.getTable().getSd().getLocation());
}
}
代码示例来源:origin: apache/hive
private static Task<?> dropTableTask(Table table, EximUtil.SemanticAnalyzerWrapperContext x,
ReplicationSpec replicationSpec) {
DropTableDesc dropTblDesc = new DropTableDesc(table.getTableName(), table.getTableType(),
true, false, replicationSpec);
return TaskFactory.get(new DDLWork(x.getInputs(), x.getOutputs(), dropTblDesc), x.getConf());
}
代码示例来源:origin: apache/drill
private void analyzeShowCreateTable(ASTNode ast) throws SemanticException {
ShowCreateTableDesc showCreateTblDesc;
String tableName = getUnescapedName((ASTNode)ast.getChild(0));
showCreateTblDesc = new ShowCreateTableDesc(tableName, ctx.getResFile().toString());
Table tab = getTable(tableName);
if (tab.getTableType() == org.apache.hadoop.hive.metastore.TableType.INDEX_TABLE) {
throw new SemanticException(ErrorMsg.SHOW_CREATETABLE_INDEX.getMsg(tableName
+ " has table type INDEX_TABLE"));
}
inputs.add(new ReadEntity(tab));
rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(),
showCreateTblDesc), conf));
setFetchTask(createFetchTask(showCreateTblDesc.getSchema()));
}
代码示例来源:origin: apache/drill
private static void getTableMetaDataInformation(StringBuilder tableInfo, Table tbl,
boolean isOutputPadded) {
formatOutput("Database:", tbl.getDbName(), tableInfo);
formatOutput("Owner:", tbl.getOwner(), tableInfo);
formatOutput("CreateTime:", formatDate(tbl.getTTable().getCreateTime()), tableInfo);
formatOutput("LastAccessTime:", formatDate(tbl.getTTable().getLastAccessTime()), tableInfo);
formatOutput("Retention:", Integer.toString(tbl.getRetention()), tableInfo);
if (!tbl.isView()) {
formatOutput("Location:", tbl.getDataLocation().toString(), tableInfo);
}
formatOutput("Table Type:", tbl.getTableType().name(), tableInfo);
if (tbl.getParameters().size() > 0) {
tableInfo.append("Table Parameters:").append(LINE_DELIM);
displayAllParameters(tbl.getParameters(), tableInfo, false, isOutputPadded);
}
}
代码示例来源:origin: apache/hive
private static void getTableMetaDataInformation(StringBuilder tableInfo, Table tbl,
boolean isOutputPadded) {
formatOutput("Database:", tbl.getDbName(), tableInfo);
formatOutput("OwnerType:", (tbl.getOwnerType() != null) ? tbl.getOwnerType().name() : "null", tableInfo);
formatOutput("Owner:", tbl.getOwner(), tableInfo);
formatOutput("CreateTime:", formatDate(tbl.getTTable().getCreateTime()), tableInfo);
formatOutput("LastAccessTime:", formatDate(tbl.getTTable().getLastAccessTime()), tableInfo);
formatOutput("Retention:", Integer.toString(tbl.getRetention()), tableInfo);
if (!tbl.isView()) {
formatOutput("Location:", tbl.getDataLocation().toString(), tableInfo);
}
formatOutput("Table Type:", tbl.getTableType().name(), tableInfo);
if (tbl.getParameters().size() > 0) {
tableInfo.append("Table Parameters:").append(LINE_DELIM);
displayAllParameters(tbl.getParameters(), tableInfo, false, isOutputPadded);
}
}
代码示例来源:origin: apache/hive
@Override
public RelNode visit(TableScan scan) {
if (scan instanceof HiveTableScan) {
HiveTableScan hiveScan = (HiveTableScan) scan;
RelOptHiveTable relOptHiveTable = (RelOptHiveTable) hiveScan.getTable();
Table tab = relOptHiveTable.getHiveTableMD();
if (tab.isTemporary()) {
fail(tab.getTableName() + " is a temporary table");
}
if (tab.getTableType() == TableType.EXTERNAL_TABLE) {
fail(tab.getFullyQualifiedName() + " is an external table");
}
return scan;
}
// TableScan of a non-Hive table - don't support for materializations.
fail(scan.getTable().getQualifiedName() + " is a table scan of a non-Hive table.");
return scan;
}
代码示例来源:origin: apache/hive
void dumpTable(String dbName, String tblName, String validTxnList, Path dbRoot, long lastReplId,
Hive hiveDb, HiveWrapper.Tuple<Table> tuple) throws Exception {
TableSpec tableSpec = new TableSpec(tuple.object);
TableExport.Paths exportPaths =
new TableExport.Paths(work.astRepresentationForErrorMsg, dbRoot, tblName, conf, true);
String distCpDoAsUser = conf.getVar(HiveConf.ConfVars.HIVE_DISTCP_DOAS_USER);
tuple.replicationSpec.setIsReplace(true); // by default for all other objects this is false
if (AcidUtils.isTransactionalTable(tableSpec.tableHandle)) {
tuple.replicationSpec.setValidTxnList(validTxnList);
tuple.replicationSpec.setValidWriteIdList(getValidWriteIdList(dbName, tblName, validTxnList));
// For transactional table, data would be valid snapshot for current txn and doesn't include data
// added/modified by concurrent txns which are later than current txn. So, need to set last repl Id of this table
// as bootstrap dump's last repl Id.
tuple.replicationSpec.setCurrentReplicationState(String.valueOf(lastReplId));
// For now we do not replicate stats for ACID table. So, wipe out column stats if any.
tableSpec.tableHandle.getTTable().unsetColStats();
}
MmContext mmCtx = MmContext.createIfNeeded(tableSpec.tableHandle);
new TableExport(
exportPaths, tableSpec, tuple.replicationSpec, hiveDb, distCpDoAsUser, conf, mmCtx).write();
replLogger.tableLog(tblName, tableSpec.tableHandle.getTableType());
}
内容来源于网络,如有侵权,请联系作者删除!