dtenedor commented on code in PR #40732:
URL: https://github.com/apache/spark/pull/40732#discussion_r1165880529


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveDefaultColumns.scala:
##########
@@ -551,24 +552,23 @@ case class ResolveDefaultColumns(resolveRelations: 
Rule[LogicalPlan]) extends Ru
    * Returns the schema for the target table of a DML command, looking into 
the catalog if needed.
    */
   private def getSchemaForTargetTable(table: LogicalPlan): Option[StructType] 
= {
-    table.foreach {
+    val resolved = table match {
+      case r: UnresolvedRelation if !r.skipSchemaResolution && !r.isStreaming 
=>
+        resolveRelation(r)
+      case other =>
+        other
+    }
+    var result: Option[StructType] = None
+    resolved.foreach {

Review Comment:
   Sounds good, done! There should only be one match in practice.



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