cloud-fan commented on a change in pull request #31273:
URL: https://github.com/apache/spark/pull/31273#discussion_r589494855



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
##########
@@ -152,10 +151,11 @@ case class CreateViewCommand(
             sparkSession,
             analyzedPlan,
             aliasedPlan.schema,
-            originalText,
-            child))
+            originalText))
       } else {
-        aliasedPlan
+        TemporaryViewRelation(
+          prepareTemporaryViewFromDataFrame(name, aliasedPlan),

Review comment:
       Here is a mistake: in the `if` branch, we call 
`prepareTemporaryView(viewIdent, ...`, and here we should also use `viewIdent` 
instead of `name`. Global temp view has 2-part name and the `name` may not be 
qualified (e.g. `df.createGlobalTempView`).
   
   @imback82 can you help to fix it with a test?




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