Skip to content

Commit

Permalink
[HOTFIX] [SQL] Fixes DataFrameWriter.mode(String)
Browse files Browse the repository at this point in the history
We forgot an assignment there.

/cc rxin

Author: Cheng Lian <[email protected]>

Closes apache#6212 from liancheng/fix-df-writer and squashes the following commits:

711fbb0 [Cheng Lian] Adds a test case
3b72d78 [Cheng Lian] Fixes DataFrameWriter.mode(String)
  • Loading branch information
liancheng committed May 16, 2015
1 parent 47e7ffe commit ce63912
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ final class DataFrameWriter private[sql](df: DataFrame) {
* @since 1.4.0
*/
def mode(saveMode: String): DataFrameWriter = {
saveMode.toLowerCase match {
this.mode = saveMode.toLowerCase match {
case "overwrite" => SaveMode.Overwrite
case "append" => SaveMode.Append
case "ignore" => SaveMode.Ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ class SaveLoadSuite extends DataSourceTest with BeforeAndAfterAll {
checkLoad()
}

test("save with string mode and path, and load") {
conf.setConf(SQLConf.DEFAULT_DATA_SOURCE_NAME, "org.apache.spark.sql.json")
path.createNewFile()
df.write.mode("overwrite").save(path.toString)
checkLoad()
}

test("save with path and datasource, and load") {
conf.setConf(SQLConf.DEFAULT_DATA_SOURCE_NAME, "not a source name")
df.write.json(path.toString)
Expand Down

0 comments on commit ce63912

Please sign in to comment.