cloud-fan commented on code in PR #40734: URL: https://github.com/apache/spark/pull/40734#discussion_r1162892352
########## 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: It seems we can do the same thing for atomic CTAS/RTAS as well: create the staging table, build a write plan with it, and call `session.sessionState.executePlan` -- 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org