linhongliu-db commented on a change in pull request #30567:
URL: https://github.com/apache/spark/pull/30567#discussion_r534217969



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
##########
@@ -266,15 +305,32 @@ case class AlterViewAsCommand(
     qe.assertAnalyzed()
     val analyzedPlan = qe.analyzed
 
-    if (session.sessionState.catalog.alterTempViewDefinition(name, 
analyzedPlan)) {
-      // a local/global temp view has been altered, we are done.
+    if (session.sessionState.catalog.isTemporaryTable(name)) {
+      alterTemporaryView(session, analyzedPlan)
     } else {
       alterPermanentView(session, analyzedPlan)
     }
-
     Seq.empty[Row]
   }
 
+  private def alterTemporaryView(session: SparkSession, analyzedPlan: 
LogicalPlan): Unit = {
+    val tableDefinition = if (conf.storeAnalyzedPlanForView) {
+      analyzedPlan
+    } else {
+      val properties = generateViewProperties(
+        Map.empty, session, analyzedPlan, analyzedPlan.schema.fieldNames)
+
+      TemporaryViewRelation(CatalogTable(

Review comment:
       we can if we move `prepareTemporaryView` to `ViewHelper`, but it's a 
little bit weird to keep `prepareTemporaryView` and `prepareTable` in 2 
different class/object




----------------------------------------------------------------
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.

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