Skip to content

Commit

Permalink
Adds DataFrame.saveAsTable() overrides which support partitioning
Browse files Browse the repository at this point in the history
  • Loading branch information
liancheng committed May 12, 2015
1 parent 1b8231f commit 3ba9bbf
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1324,6 +1324,28 @@ class DataFrame private[sql](
saveAsTable(tableName, source, mode, options.toMap)
}

/**
* :: Experimental ::
* Creates a table at the given path from the the contents of this DataFrame
* based on a given data source, [[SaveMode]] specified by mode, a set of options, and a list of
* partition columns.
*
* Note that this currently only works with DataFrames that are created from a HiveContext as
* there is no notion of a persisted catalog in a standard SQL context. Instead you can write
* an RDD out to a parquet file, and then register that file as a table. This "table" can then
* be the target of an `insertInto`.
* @group output
*/
@Experimental
def saveAsTable(
tableName: String,
source: String,
mode: SaveMode,
options: java.util.Map[String, String],
partitionColumns: java.util.List[String]): Unit = {
???
}

/**
* :: Experimental ::
* (Scala-specific)
Expand Down Expand Up @@ -1357,6 +1379,28 @@ class DataFrame private[sql](
sqlContext.executePlan(cmd).toRdd
}

/**
* :: Experimental ::
* Creates a table at the given path from the the contents of this DataFrame
* based on a given data source, [[SaveMode]] specified by mode, a set of options, and a list of
* partition columns.
*
* Note that this currently only works with DataFrames that are created from a HiveContext as
* there is no notion of a persisted catalog in a standard SQL context. Instead you can write
* an RDD out to a parquet file, and then register that file as a table. This "table" can then
* be the target of an `insertInto`.
* @group output
*/
@Experimental
def saveAsTable(
tableName: String,
source: String,
mode: SaveMode,
options: Map[String, String],
partitionColumns: Seq[String]): Unit = {
???
}

/**
* :: Experimental ::
* Saves the contents of this DataFrame to the given path,
Expand Down

0 comments on commit 3ba9bbf

Please sign in to comment.