You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "cloud-fan (via GitHub)" <gi...@apache.org> on 2023/06/02 00:06:40 UTC

[GitHub] [spark] cloud-fan commented on a diff in pull request #40908: [SPARK-42750][SQL] Support Insert By Name statement

cloud-fan commented on code in PR #40908:
URL: https://github.com/apache/spark/pull/40908#discussion_r1213789191


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:
##########
@@ -1289,6 +1291,12 @@ class Analyzer(override val catalogManager: CatalogManager) extends RuleExecutor
         // Create a project if this is an INSERT INTO BY NAME query.
         val projectByName = if (i.userSpecifiedCols.nonEmpty) {
           Some(createProjectForByNameQuery(i))
+        } else if (i.byName) {
+          val partition = i.partitionSpec.filter(p => p._2.isDefined).keySet
+          val output = i.table.output.filter(col => {
+            !partition.exists(p => conf.resolver(col.name, p))
+          })
+          Some(resolveOutputColumns(r.table.name, output, i.query, i.byName, conf))

Review Comment:
   why do we reorder columns here? It will be handled by `ResolveOutputRelation` rule later, after we turn `InsertIntoStatement` into v2 write command.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org