gatorsmile commented on a change in pull request #23606: [SPARK-26666][SQL]
Support DSv2 overwrite and dynamic partition overwrite.
URL: https://github.com/apache/spark/pull/23606#discussion_r255319922
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -2237,14 +2242,34 @@ class Analyzer(
object ResolveOutputRelation extends Rule[LogicalPlan] {
override def apply(plan: LogicalPlan): LogicalPlan = plan.resolveOperators
{
case append @ AppendData(table, query, isByName)
- if table.resolved && query.resolved && !append.resolved =>
+ if table.resolved && query.resolved && !append.writeResolved =>
val projection = resolveOutputColumns(table.name, table.output, query,
isByName)
if (projection != query) {
append.copy(query = projection)
} else {
append
}
+
+ case overwrite @ OverwriteByExpression(table, _, query, isByName)
+ if table.resolved && query.resolved && !overwrite.writeResolved =>
+ val projection = resolveOutputColumns(table.name, table.output, query,
isByName)
+
+ if (projection != query) {
+ overwrite.copy(query = projection)
+ } else {
+ overwrite
+ }
+
+ case overwrite @ OverwritePartitionsDynamic(table, query, isByName)
+ if table.resolved && query.resolved && !overwrite.writeResolved =>
Review comment:
Nit: two more space
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]