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/04/11 14:14:59 UTC

[GitHub] [spark] cloud-fan commented on a diff in pull request #40734: [SPARK-43088][SQL] Respect RequiresDistributionAndOrdering in CTAS/RTAS

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


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala:
##########
@@ -184,19 +175,23 @@ class DataSourceV2Strategy(session: SparkSession) extends Strategy with Predicat
         newSchema, catalog.asTableCatalog, ident, "CREATE TABLE")
 
       CreateTableExec(catalog.asTableCatalog, ident, structTypeToV2Columns(newSchema),
-        partitioning, qualifyLocInTableSpec(tableSpec), ifNotExists) :: Nil
+        partitioning, qualifyLocInTableSpec(session, tableSpec), ifNotExists) :: Nil
 
     case CreateTableAsSelect(ResolvedIdentifier(catalog, ident), parts, query, tableSpec,
-        options, ifNotExists, analyzedQuery) =>
+        options, ifNotExists, analyzedQuery, table, write) =>
       assert(analyzedQuery.isDefined)
       val writeOptions = new CaseInsensitiveStringMap(options.asJava)
       catalog match {
         case staging: StagingTableCatalog =>
-          AtomicCreateTableAsSelectExec(staging, ident, parts, analyzedQuery.get, planLater(query),
-            qualifyLocInTableSpec(tableSpec), writeOptions, ifNotExists) :: Nil
+          assert(table.isDefined)
+          assert(write.isDefined)
+          AtomicCreateTableAsSelectExec(

Review Comment:
   we can probably follow v1 write and trigger a nested execution to do table insertion in CTAS/RTAS command: https://github.com/apache/spark/commit/4b40920e33176fc8b18380703e4dcf4d16824094



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