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; }
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(); } }
sb.append(expandedText); sb.append(") "); sb.append(HiveUtils.unparseIdentifier(createVwDesc.getViewName(), conf)); expandedText = sb.toString(); sb.append(expandedText); sb.append(") "); sb.append(HiveUtils.unparseIdentifier(createVwDesc.getViewName(), conf)); expandedText = sb.toString();
sb.append(expandedText); sb.append(") "); sb.append(HiveUtils.unparseIdentifier(createVwDesc.getViewName(), conf)); expandedText = sb.toString();
if (crtViewDesc.getViewName() != null && crtViewDesc.isMaterialized()) { properties.setProperty(org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_NAME, crtViewDesc.getViewName());
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(); } }
boolean disableRewrite = false; if (work.getCreateViewDesc() != null && work.getCreateViewDesc().isMaterialized()) { tableName = work.getCreateViewDesc().getViewName(); retrieveAndInclude = work.getCreateViewDesc().isRewriteEnabled(); } else if (work.getAlterMaterializedViewDesc() != null) {
private void validateCreateView() throws SemanticException { try { Table oldView = getTable(createVwDesc.getViewName(), false); "The following view does not exist: " + createVwDesc.getViewName(); throw new SemanticException( ErrorMsg.ALTER_VIEW_AS_SELECT_NOT_EXIST.getMsg(viewNotExistErrorMsg)); String tableNotViewErrorMsg = "The following is an existing table, not a view: " + createVwDesc.getViewName(); throw new SemanticException( ErrorMsg.EXISTING_TABLE_IS_NOT_VIEW.getMsg(tableNotViewErrorMsg)); createVwDesc.getViewName(); try { if ((createVwDesc.getPartCols() == null ||
.mapDirToOp(new Path(createVwDesc.getViewName()), sinkOp);
Table oldview = db.getTable(crtView.getViewName(), false); if (oldview != null) { } else { LOG.debug("DDLTask: Create View is skipped as view {} is newer than update", crtView.getViewName()); // no replacement, the existing table state is newer than our update. return 0; throw new HiveException(ErrorMsg.TABLE_ALREADY_EXISTS.getMsg(crtView.getViewName())); db.alterTable(crtView.getViewName(), oldview, false, null, true); addIfAbsentByName(new WriteEntity(oldview, WriteEntity.WriteType.DDL_NO_LOCK)); } else { queryState.getLineageState().setLineage(new Path(crtView.getViewName()), dc, tbl.getCols());
public Table toTable(HiveConf conf) throws HiveException { String[] names = Utilities.getDbTableName(getViewName()); String databaseName = names[0]; String tableName = names[1]; serDeClassName = PlanUtils.getDefaultSerDe().getName(); LOG.info("Default to {} for materialized view {}", serDeClassName, getViewName()); } else { serDeClassName = storageHandler.getSerDeClass().getName(); LOG.info("Use StorageHandler-supplied {} for materialized view {}", serDeClassName, getViewName());
private void validateCreateView() throws SemanticException { try { Table oldView = getTable(createVwDesc.getViewName(), false); "The following view does not exist: " + createVwDesc.getViewName(); throw new SemanticException( ErrorMsg.ALTER_VIEW_AS_SELECT_NOT_EXIST.getMsg(viewNotExistErrorMsg)); String tableNotViewErrorMsg = "The following is an existing table, not a view: " + createVwDesc.getViewName(); throw new SemanticException( ErrorMsg.EXISTING_TABLE_IS_NOT_VIEW.getMsg(tableNotViewErrorMsg)); createVwDesc.getViewName(); try { if ((createVwDesc.getPartCols() == null ||
.mapDirToOp(new Path(createVwDesc.getViewName()), sinkOp);
viewsExpanded.add(createVwDesc.getViewName());
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); } }
viewSelect = newAST; viewsExpanded = new ArrayList<>(); viewsExpanded.add(createVwDesc.getViewName()); } else if (cboCtx.type == PreCboCtx.Type.CTAS) {
viewsExpanded.add(createVwDesc.getViewName());
protoName = pCtx.getCreateTable().getTableName(); } else if (pCtx.getQueryProperties().isMaterializedView()) { protoName = pCtx.getCreateViewDesc().getViewName();
Table oldview = db.getTable(crtView.getViewName(), false); if (crtView.getOrReplace() && oldview != null) { if (!crtView.isMaterialized()) { db.alterTable(crtView.getViewName(), oldview, null); } catch (InvalidOperationException e) { throw new HiveException(e); Table tbl = db.newTable(crtView.getViewName()); tbl.setViewOriginalText(crtView.getViewOriginalText()); if (crtView.isMaterialized()) { SessionState.get().getLineageState().setLineage(new Path(crtView.getViewName()), dc, tbl.getCols());