longvu-db commented on code in PR #57142:
URL: https://github.com/apache/spark/pull/57142#discussion_r3614663423


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:
##########
@@ -1154,6 +1154,8 @@ class Analyzer(
         // Thus, we need to look at the raw plan if `relation` is a temporary 
view.
         // unwrapRelationPlan also resolves V2TableReference nodes in temp 
view plans.
         unwrapRelationPlan(relation) match {
+          case v: View if i.replaceCriteriaOpt.exists(_.isReplaceWhere) =>

Review Comment:
   It's a nit, but I was just thinking it's worth pointing out there is another 
place in this same file which rejects Write, ideally there should only be one 
place which rejects Write >< View altogether, but unfortunately there are 2.
   
   
https://github.com/leonwind/spark/blob/4f49d3f8fd9e33ecbee4eae37be5b95ee05d0a83/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala#L1176C7-L1191C10
   
   > case write: V2WriteCommand =>
           write.table match {
             case u: UnresolvedRelation if !u.isStreaming =>
               resolveRelation(u).map(unwrapRelationPlan).map {
                 case v: View => throw 
QueryCompilationErrors.writeIntoViewNotAllowedError(
                   v.desc.identifier, write)
                 case u: UnresolvedCatalogRelation =>
                   throw QueryCompilationErrors.writeIntoV1TableNotAllowedError(
                     u.tableMeta.identifier, write)
                 case r: DataSourceV2Relation => write.withNewTable(r)
                 case _ =>
                   throw 
QueryCompilationErrors.writeIntoTempViewNotAllowedError(
                     u.multipartIdentifier.quoted)
               }.getOrElse(write)
             case _ => write
           }



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