dengzhhu653 commented on code in PR #6087:
URL: https://github.com/apache/hive/pull/6087#discussion_r2386611571


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/view/create/AlterViewAsAnalyzer.java:
##########
@@ -67,14 +67,16 @@ public void analyzeInternal(ASTNode root) throws 
SemanticException {
     String expandedText = 
ctx.getTokenRewriteStream().toString(select.getTokenStartIndex(), 
select.getTokenStopIndex());
 
     AlterViewAsDesc desc = new AlterViewAsDesc(fqViewName, schema, 
originalText, expandedText);
-    validateCreateView(desc, analyzer);
+    Table oldView = validateCreateView(desc, analyzer);
+    oldView.setDbName(viewName.getDb());
+    oldView.setTableName(viewName.getTable());
+    oldView.setTableType(TableType.VIRTUAL_VIEW);
 
     rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), 
desc)));
-    DDLUtils.addDbAndTableToOutputs(getDatabase(viewName.getDb()), viewName, 
TableType.VIRTUAL_VIEW, false,
-        null, outputs);
+    DDLUtils.addDbAndTableToOutputs(getDatabase(viewName.getDb()), oldView, 
outputs);

Review Comment:
   I don't get it, before this fix `DDLUtils.addDbAndTableToOutputs` will 
created a dummy table based on `viewName`, it has the same `db` and `table` 
with the `oldView`, why it doesn't work before?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to