morvenhuang commented on code in PR #36212:
URL: https://github.com/apache/spark/pull/36212#discussion_r856328251


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveDefaultColumns.scala:
##########
@@ -131,17 +131,21 @@ case class ResolveDefaultColumns(
    * Adds a new expressions to a projection to generate missing default column 
values.
    */
   private def addMissingDefaultColumnValues(project: Project): Option[Project] 
= {
-    val numQueryOutputs: Int = project.projectList.size
-    val schema = insertTableSchemaWithoutPartitionColumns.getOrElse(return 
None)
-    val newDefaultExpressions: Seq[Expression] = 
getDefaultExpressions(numQueryOutputs, schema)
-    val newAliases: Seq[NamedExpression] =
-      newDefaultExpressions.zip(schema.fields).map {
-        case (expr, field) => Alias(expr, field.name)()
-      }
-    if (newDefaultExpressions.nonEmpty) {
-      Some(project.copy(projectList = project.projectList ++ newAliases))
-    } else {
+    if (project.projectList.exists(_.isInstanceOf[Star])) {

Review Comment:
   Thank you for pointing out this, I've moved it to line 82.



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