You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "uros-b (via GitHub)" <gi...@apache.org> on 2026/06/24 10:01:57 UTC
Re: [PR] [SPARK-57616][SQL] Extend SupportsCatalogOptions to allow migration from DSv1 file based data source [spark]
uros-b commented on code in PR #56617:
URL: https://github.com/apache/spark/pull/56617#discussion_r3466203964
##########
sql/core/src/main/scala/org/apache/spark/sql/classic/DataFrameWriter.scala:
##########
@@ -168,66 +168,90 @@ final class DataFrameWriter[T] private[sql](ds: Dataset[T]) extends sql.DataFram
import org.apache.spark.sql.execution.datasources.v2.DataSourceV2Implicits._
val catalogManager = df.sparkSession.sessionState.catalogManager
+
+ def createTableAsSelectCommand(
+ catalog: TableCatalog, ident: Identifier, ignoreIfExists: Boolean): LogicalPlan = {
+ val tableSpec = UnresolvedTableSpec(
+ properties = Map.empty,
+ provider = Some(source),
+ optionExpression = OptionList(Seq.empty),
+ location = extraOptions.get("path"),
+ comment = extraOptions.get(TableCatalog.PROP_COMMENT),
+ collation = extraOptions.get(TableCatalog.PROP_COLLATION),
+ serde = None,
+ external = false,
+ constraints = Seq.empty)
+ CreateTableAsSelect(
+ UnresolvedIdentifier(
+ catalog.name +: ident.namespace.toImmutableArraySeq :+ ident.name),
+ partitioningAsV2,
+ df.queryExecution.analyzed,
+ tableSpec,
+ finalOptions,
+ ignoreIfExists = ignoreIfExists)
+ }
+
+ def appendOrOverwriteCommand(
Review Comment:
Is schema-evolution ignored on the new create-on-write path? When `failWriteIfTableDoesNotExist=false` routes a missing-table Append/Overwrite to CTAS, `_withSchemaEvolution` is silently ignored, whereas the dedicated `createMode` branch guards it by throwing `schemaEvolutionNotSupportedForCreateTableWriteError`. This is an inconsistency and is untested, pick one behavior (throw, or document that schema evolution is a no-op on create) and cover it.
--
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