cloud-fan commented on a change in pull request #34667:
URL: https://github.com/apache/spark/pull/34667#discussion_r759931289
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala
##########
@@ -323,18 +323,25 @@ final class DataFrameWriter[T] private[sql](ds:
Dataset[T]) {
provider match {
case supportsExtract: SupportsCatalogOptions =>
val ident = supportsExtract.extractIdentifier(dsOptions)
- val catalog = CatalogV2Util.getTableProviderCatalog(
- supportsExtract, catalogManager, dsOptions)
+ val catalog = if (ident.namespace().isEmpty) {
+ Array(dsOptions.get("catalog"))
+ } else {
+ ident.namespace()
+ }
val location =
Option(dsOptions.get("path")).map(TableCatalog.PROP_LOCATION -> _)
-
+ val tableSpec = TableSpec(None, Map.empty, Some(source),
Map.empty,
Review comment:
there are a lot of literals here, let's call the method using named
parameters, e.g. `TableSpec(bucketSpec = None, ...)`
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala
##########
@@ -604,20 +611,17 @@ final class DataFrameWriter[T] private[sql](ds:
Dataset[T]) {
// We have a potential race condition here in AppendMode, if the table
suddenly gets
// created between our existence check and physical execution, but
this can't be helped
// in any case.
- CreateTableAsSelectStatement(
- nameParts,
- df.queryExecution.analyzed,
+ val tableSpec = TableSpec(None, Map.empty, Some(source), Map.empty,
Review comment:
ditto
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/DataFrameWriterV2.scala
##########
@@ -107,21 +107,16 @@ final class DataFrameWriterV2[T] private[sql](table:
String, ds: Dataset[T])
}
override def create(): Unit = {
+ val tableSpec = TableSpec(None, properties.toMap, provider, Map.empty,
Review comment:
ditto
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]