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

    https://github.com/apache/spark/pull/6216#discussion_r30487662
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala ---
    @@ -151,19 +153,52 @@ final class DataFrameWriter private[sql](df: 
DataFrame) {
       /**
        * Saves the content of the [[DataFrame]] as the specified table.
        *
    +   * In the case the table already exists, behavior of this function 
depends on the
    +   * save mode, specified by the `mode` function (default to throwing an 
exception).
    +   *
        * @since 1.4.0
        */
       def saveAsTable(tableName: String): Unit = {
    -    val cmd =
    -      CreateTableUsingAsSelect(
    -        tableName,
    -        source,
    -        temporary = false,
    -        partitioningColumns.map(_.toArray).getOrElse(Array.empty[String]),
    -        mode,
    -        extraOptions.toMap,
    -        df.logicalPlan)
    -    df.sqlContext.executePlan(cmd).toRdd
    +    if (df.sqlContext.catalog.tableExists(tableName :: Nil)) {
    +      if (partitioningColumns.isDefined) {
    +        sys.error("Inserting data into an existing partitioned table is 
not yet supported.")
    --- End diff --
    
    Well, double checked, we don't support converting partitioned (Parquet) 
Hive metastore tables.


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