public LoadFileDesc(final CreateTableDesc createTableDesc, final CreateViewDesc createViewDesc, final Path sourcePath, final Path targetDir, final boolean isDfsDir, final String columns, final String columnTypes) { this(sourcePath, targetDir, isDfsDir, columns, columnTypes); if (createTableDesc != null && createTableDesc.getDatabaseName() != null && createTableDesc.getTableName() != null) { destinationCreateTable = (createTableDesc.getTableName().contains(".") ? "" : createTableDesc .getDatabaseName() + ".") + createTableDesc.getTableName(); } else if (createViewDesc != null) { // The work is already done in analyzeCreateView to assure that the view name is fully // qualified. destinationCreateTable = createViewDesc.getViewName(); } }
public String getTableName() throws SemanticException { switch (getDescType()) { case TABLE: return createTblDesc.getTableName(); case VIEW: String dbDotView = createViewDesc.getViewName(); String[] names = Utilities.getDbTableName(dbDotView); return names[1]; // names[0] have the Db name and names[1] have the view name } return null; }
public String getTableName() throws SemanticException { switch (getTableType()) { case TABLE: return createTblDesc.getTableName(); case VIEW: String dbDotView = createViewDesc.getViewName(); String[] names = Utilities.getDbTableName(dbDotView); return names[1]; // names[0] have the Db name and names[1] have the view name } return null; }
Table table = context.getHive().newTable(desc.getTableName()); if (desc.getLocation() != null) { table.setDataLocation(new Path(desc.getLocation()));
if (crtTblDesc.getTableName() != null && crtTblDesc.getDatabaseName() != null) { properties.setProperty(org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_NAME, crtTblDesc.getTableName());
if (crtTblDesc.getTableName() != null && crtTblDesc.getDatabaseName() != null) { properties.setProperty(org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_NAME, crtTblDesc.getTableName());
private void handleLineage(LoadTableDesc ltd, Operator output) throws SemanticException { if (ltd != null) { queryState.getLineageState() .mapDirToOp(ltd.getSourcePath(), output); } else if ( queryState.getCommandType().equals(HiveOperation.CREATETABLE_AS_SELECT.getOperationName())) { Path tlocation = null; String tName = Utilities.getDbTableName(tableDesc.getTableName())[1]; try { Warehouse wh = new Warehouse(conf); tlocation = wh.getDefaultTablePath(db.getDatabase(tableDesc.getDatabaseName()), tName, tableDesc.isExternal()); } catch (MetaException|HiveException e) { throw new SemanticException(e); } queryState.getLineageState() .mapDirToOp(tlocation, output); } }
public String getTableName() { BasicStatsWork work = this; if (work.getLoadTableDesc() != null) { return work.getLoadTableDesc().getTable().getTableName(); } else if (work.getTableSpecs() != null) { return work.getTableSpecs().tableName; } else if (getLoadFileDesc().getCtasCreateTableDesc() != null) { return getLoadFileDesc().getCtasCreateTableDesc().getTableName(); } else { return getLoadFileDesc().getCreateViewDesc().getViewName(); } }
} else { LOG.debug("DDLTask: Create Table is skipped as table {} is newer than update", crtTbl.getTableName()); return 0; // no replacement, the existing table state is newer than our update.
private Path getDefaultCtasLocation(final ParseContext pCtx) throws SemanticException { try { String protoName = null; boolean isExternal = false; if (pCtx.getQueryProperties().isCTAS()) { protoName = pCtx.getCreateTable().getTableName(); isExternal = pCtx.getCreateTable().isExternal(); } else if (pCtx.getQueryProperties().isMaterializedView()) { protoName = pCtx.getCreateViewDesc().getViewName(); } String[] names = Utilities.getDbTableName(protoName); if (!db.databaseExists(names[0])) { throw new SemanticException("ERROR: The database " + names[0] + " does not exist."); } Warehouse wh = new Warehouse(conf); return wh.getDefaultTablePath(db.getDatabase(names[0]), names[1], isExternal); } catch (HiveException e) { throw new SemanticException(e); } catch (MetaException e) { throw new SemanticException(e); } }
public Table toTable(HiveConf conf) throws HiveException { String databaseName = getDatabaseName(); String tableName = getTableName(); ColumnStatisticsDesc colStatsDesc = new ColumnStatisticsDesc(colStats.getStatsDesc()); colStatsDesc.setCatName(tbl.getCatName()); colStatsDesc.setDbName(getTableName()); colStatsDesc.setDbName(getDatabaseName()); tbl.getTTable().setColStats(new ColumnStatistics(colStatsDesc, colStats.getStatsObj()));
String tName = Utilities.getDbTableName(tableDesc.getTableName())[1]; try { Warehouse wh = new Warehouse(conf);
public Table toTable(HiveConf conf) throws HiveException { String databaseName = getDatabaseName(); String tableName = getTableName();
writeId = txnMgr.getTableWriteId(tblDesc.getDatabaseName(), tblDesc.getTableName());
String protoName = null; if (pCtx.getQueryProperties().isCTAS()) { protoName = pCtx.getCreateTable().getTableName(); } else if (pCtx.getQueryProperties().isMaterializedView()) { protoName = pCtx.getCreateViewDesc().getViewName();
/** * @deprecated */ @Override @Deprecated public String getTableName() { return super.getTableName(); }
/** * @deprecated */ @Override @Deprecated public String getTableName() { return super.getTableName(); }
public LoadFileDesc(final CreateTableDesc createTableDesc, final Path sourcePath, final Path targetDir, final boolean isDfsDir, final String columns, final String columnTypes) { this(sourcePath, targetDir, isDfsDir, columns, columnTypes); if (createTableDesc != null && createTableDesc.getDatabaseName() != null && createTableDesc.getTableName() != null) { destinationCreateTable = (createTableDesc.getTableName().contains(".") ? "" : createTableDesc .getDatabaseName() + ".") + createTableDesc.getTableName(); } }
/** * Utility method that returns a table if one corresponding to the destination * tblDesc is found. Returns null if no such table is found. */ private Table tableIfExists(CreateTableDesc tblDesc) throws HiveException { try { return db.getTable(tblDesc.getDatabaseName(),tblDesc.getTableName()); } catch (InvalidTableException e) { return null; } }
private AddPartitionDesc getBaseAddPartitionDescFromPartition( Path fromPath, String dbname, CreateTableDesc tblDesc, Partition partition) throws MetaException { AddPartitionDesc partsDesc = new AddPartitionDesc(dbname, tblDesc.getTableName(), EximUtil.makePartSpec(tblDesc.getPartCols(), partition.getValues()), partition.getSd().getLocation(), partition.getParameters()); AddPartitionDesc.OnePartitionDesc partDesc = partsDesc.getPartition(0); partDesc.setInputFormat(partition.getSd().getInputFormat()); partDesc.setOutputFormat(partition.getSd().getOutputFormat()); partDesc.setNumBuckets(partition.getSd().getNumBuckets()); partDesc.setCols(partition.getSd().getCols()); partDesc.setSerializationLib(partition.getSd().getSerdeInfo().getSerializationLib()); partDesc.setSerdeParams(partition.getSd().getSerdeInfo().getParameters()); partDesc.setBucketCols(partition.getSd().getBucketCols()); partDesc.setSortCols(partition.getSd().getSortCols()); partDesc.setLocation(new Path(fromPath, Warehouse.makePartName(tblDesc.getPartCols(), partition.getValues())).toString()); return partsDesc; }