Github user maropu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17758#discussion_r125205813
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala ---
    @@ -123,28 +122,19 @@ case class CreateViewCommand(
       }
     
       override def run(sparkSession: SparkSession): Seq[Row] = {
    -    // If the plan cannot be analyzed, throw an exception and don't 
proceed.
    -    val qe = sparkSession.sessionState.executePlan(child)
    -    qe.assertAnalyzed()
    -    val analyzedPlan = qe.analyzed
    -
         if (userSpecifiedColumns.nonEmpty &&
    -        userSpecifiedColumns.length != analyzedPlan.output.length) {
    +        userSpecifiedColumns.length != child.output.length) {
           throw new AnalysisException(s"The number of columns produced by the 
SELECT clause " +
    -        s"(num: `${analyzedPlan.output.length}`) does not match the number 
of column names " +
    +        s"(num: `${child.output.length}`) does not match the number of 
column names " +
             s"specified by CREATE VIEW (num: 
`${userSpecifiedColumns.length}`).")
         }
     
    -    // When creating a permanent view, not allowed to reference temporary 
objects.
    -    // This should be called after `qe.assertAnalyzed()` (i.e., `child` 
can be resolved)
    -    verifyTemporaryObjectsNotExists(sparkSession)
    --- End diff --
    
    I moved `verifyTemporaryObjectsNotExists` to `rules` because 
`qe.assertAnalyzed()` is called in `rules` and a resolved plan is passed here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to