Refine search
public TableSpec(Table table) { tableHandle = table; tableName = table.getDbName() + "." + table.getTableName(); specType = SpecType.TABLE_ONLY; }
public String getFullTableName() { return table.getDbName() + "." + table.getTableName(); }
@Override public String getSimpleName() { return String.format("Table %s.%s", table.getDbName(), table.getTableName()); }
private static String getTmptTableNameForExport(Table exportTable) { String tmpTableDb = exportTable.getDbName(); String tmpTableName = exportTable.getTableName() + "_" + UUID.randomUUID().toString().replace('-', '_'); return Warehouse.getQualifiedName(tmpTableDb, tmpTableName); }
/** * @return include the db name */ public String getCompleteName() { return getCompleteName(getDbName(), getTableName()); }
/** Note: this is generally called in Hive.java; so, the callers of Hive.java make sure * to set up the acid state during compile, and Hive.java retrieves it if needed. */ public static TableSnapshot getTableSnapshot( Configuration conf, Table tbl, boolean isStatsUpdater) throws LockException { return getTableSnapshot(conf, tbl, tbl.getDbName(), tbl.getTableName(), isStatsUpdater); }
/** * Removes the materialized view from the cache. * * @param materializedViewTable the materialized view to remove */ public void dropMaterializedView(Table materializedViewTable) { dropMaterializedView(materializedViewTable.getDbName(), materializedViewTable.getTableName()); }
@Override public String getSimpleName() { return String.format("Partition %s.%s %s", table.getDbName(), table.getTableName(), partition.getSpec()); }
/** * Generate the statement of analyze table [tablename] compute statistics for columns * In non-partitioned table case, it will generate TS-SEL-GBY-RS-GBY-SEL-FS operator * In static-partitioned table case, it will generate TS-FIL(partitionKey)-SEL-GBY(partitionKey)-RS-GBY-SEL-FS operator * In dynamic-partitioned table case, it will generate TS-SEL-GBY(partitionKey)-RS-GBY-SEL-FS operator * However, we do not need to specify the partition-spec because (1) the data is going to be inserted to that specific partition * (2) we can compose the static/dynamic partition using a select operator in replaceSelectOperatorProcess. */ public void insertAnalyzePipeline() throws SemanticException{ String analyzeCommand = "analyze table `" + tbl.getDbName() + "`.`" + tbl.getTableName() + "`" + " compute statistics for columns "; insertAnalyzePipeline(analyzeCommand, false); }
/** * Resolve {@value #DATABASE_TOKEN} and {@value #TABLE_TOKEN} in <code>rawString</code> to {@link Table#getDbName()} * and {@link Table#getTableName()} */ public static String resolveTemplate(String rawString, Table table) { if (StringUtils.isBlank(rawString)) { return rawString; } return StringUtils.replaceEach(rawString, new String[] { DATABASE_TOKEN, TABLE_TOKEN }, new String[] { table.getDbName(), table.getTableName() }); }
public HiveLockObject(Table tbl, HiveLockObjectData lockData) { this(new String[] {tbl.getDbName(), org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.encodeTableName(tbl.getTableName())}, lockData); }
/** * @return include the db name */ public String getCompleteName() { return getCompleteName(getDbName(), getTableName()); }
private void alterPartitionSpec(Table tbl, Map<String, String> partSpec, org.apache.hadoop.hive.metastore.api.Partition tpart, boolean inheritTableSpecs, String partPath) throws HiveException, InvalidOperationException { alterPartitionSpecInMemory(tbl, partSpec, tpart, inheritTableSpecs, partPath); String fullName = tbl.getTableName(); if (!org.apache.commons.lang.StringUtils.isEmpty(tbl.getDbName())) { fullName = tbl.getDbName() + "." + tbl.getTableName(); } alterPartition(fullName, new Partition(tbl, tpart), null); }
public void alterTable(Table newTbl, boolean cascade, EnvironmentContext environmentContext, boolean transactional) throws HiveException { alterTable(newTbl.getCatName(), newTbl.getDbName(), newTbl.getTableName(), newTbl, cascade, environmentContext, transactional); }
public TableScanDesc(final String alias, List<VirtualColumn> vcs, Table tblMetadata) { this.alias = alias; this.virtualCols = vcs; this.tableMetadata = tblMetadata; if (tblMetadata != null) { dbName = tblMetadata.getDbName(); tableName = tblMetadata.getTableName(); } isTranscationalTable = AcidUtils.isTransactionalTable(this.tableMetadata); if (isTranscationalTable) { acidOperationalProperties = AcidUtils.getAcidOperationalProperties(this.tableMetadata); } }
private List<String> getTablesFromEntitySet(Set<? extends Entity> entities) { List<String> tableNames = new ArrayList<>(); for (Entity entity : entities) { if (entity.getType() == Entity.Type.TABLE) { tableNames.add(entity.getTable().getDbName() + "." + entity.getTable().getTableName()); } } return tableNames; }
private void alterPartitionSpec(Table tbl, Map<String, String> partSpec, org.apache.hadoop.hive.metastore.api.Partition tpart, boolean inheritTableSpecs, String partPath) throws HiveException, InvalidOperationException { alterPartitionSpecInMemory(tbl, partSpec, tpart, inheritTableSpecs, partPath); String fullName = tbl.getTableName(); if (!org.apache.commons.lang.StringUtils.isEmpty(tbl.getDbName())) { fullName = tbl.getFullyQualifiedName(); } alterPartition(tbl.getCatalogName(), tbl.getDbName(), tbl.getTableName(), new Partition(tbl, tpart), null, true); }
protected List<String> getTablesFromEntitySet(Set<? extends Entity> entities) { List<String> tableNames = new ArrayList<String>(); for (Entity entity : entities) { if (entity.getType() == Entity.Type.TABLE) { tableNames.add(entity.getTable().getDbName() + "." + entity.getTable().getTableName()); } } return tableNames; }
protected static Map<String, String> getColNameToDefaultValueMap(Table tbl) throws SemanticException { Map<String, String> colNameToDefaultVal = null; try { DefaultConstraint dc = Hive.get().getEnabledDefaultConstraints(tbl.getDbName(), tbl.getTableName()); colNameToDefaultVal = dc.getColNameToDefaultValueMap(); } catch (Exception e) { if (e instanceof SemanticException) { throw (SemanticException) e; } else { throw (new RuntimeException(e)); } } return colNameToDefaultVal; }
@Override public void authorize(Table table, Privilege[] inputRequiredPriv, Privilege[] outputRequiredPriv) throws HiveException { BitSetChecker checker = BitSetChecker.getBitSetChecker(inputRequiredPriv, outputRequiredPriv); boolean[] inputCheck = checker.inputCheck; boolean[] outputCheck = checker.outputCheck; authorizeUserDBAndTable(table, inputRequiredPriv, outputRequiredPriv, inputCheck, outputCheck); checkAndThrowAuthorizationException(inputRequiredPriv, outputRequiredPriv, inputCheck, outputCheck, table.getDbName(), table.getTableName(), null, null); }