Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14155#discussion_r73633166
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/createDataSourceTables.scala
 ---
    @@ -275,238 +269,21 @@ case class CreateDataSourceTableAsSelectCommand(
           // We will use the schema of resolved.relation as the schema of the 
table (instead of
           // the schema of df). It is important since the nullability may be 
changed by the relation
           // provider (for example, see 
org.apache.spark.sql.parquet.DefaultSource).
    -      CreateDataSourceTableUtils.createDataSourceTable(
    -        sparkSession = sparkSession,
    -        tableIdent = tableIdent,
    -        schema = result.schema,
    -        partitionColumns = partitionColumns,
    -        bucketSpec = bucketSpec,
    -        provider = provider,
    -        options = optionsWithPath,
    -        isExternal = isExternal)
    +      val schema = result.schema
    +      val table = CatalogTable(
    +        identifier = tableIdent,
    +        tableType = if (isExternal) CatalogTableType.EXTERNAL else 
CatalogTableType.MANAGED,
    +        storage = CatalogStorageFormat.empty.copy(properties = 
optionsWithPath),
    +        schema = schema,
    +        provider = Some(provider),
    +        partitionColumnNames = partitionColumns,
    +        bucketSpec = bucketSpec
    +      )
    +      sessionState.catalog.createTable(table, ignoreIfExists = false)
         }
     
         // Refresh the cache of the table in the catalog.
         sessionState.catalog.refreshTable(tableIdent)
         Seq.empty[Row]
       }
     }
    -
    -
    -object CreateDataSourceTableUtils extends Logging {
    --- End diff --
    
    let's add some comments if we are moving some blocks of code to another 
file :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to