Skip to content

Commit

Permalink
address comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
gatorsmile committed Sep 17, 2016
1 parent 44f335b commit da5bec6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ final class DataFrameWriter[T] private[sql](ds: Dataset[T]) {
* @since 1.4.0
*/
def format(source: String): DataFrameWriter[T] = {
if (source.toLowerCase == "hive") {
throw new AnalysisException(s"Failed to find data source: $source")
}
this.source = source
this
}
Expand Down Expand Up @@ -360,6 +357,9 @@ final class DataFrameWriter[T] private[sql](ds: Dataset[T]) {
}

private def saveAsTable(tableIdent: TableIdentifier): Unit = {
if (source.toLowerCase == "hive") {
throw new AnalysisException("Cannot create hive serde table with saveAsTable API")
}

val tableExists = df.sparkSession.sessionState.catalog.tableExists(tableIdent)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ class MetastoreDataSourcesSuite extends QueryTest with SQLTestUtils with TestHiv
test("save API - format hive") {
withTempDir { dir =>
val path = dir.getCanonicalPath
val e = intercept[AnalysisException] {
val e = intercept[ClassNotFoundException] {
spark.range(10).write.format("hive").mode(SaveMode.Ignore).save(path)
}.getMessage
assert(e.contains("Failed to find data source: hive"))
Expand All @@ -1168,7 +1168,7 @@ class MetastoreDataSourcesSuite extends QueryTest with SQLTestUtils with TestHiv
val e = intercept[AnalysisException] {
spark.range(10).write.format("hive").mode(SaveMode.Overwrite).saveAsTable(tableName)
}.getMessage
assert(e.contains("Failed to find data source: hive"))
assert(e.contains("Cannot create hive serde table with saveAsTable API"))
}
}

Expand Down

0 comments on commit da5bec6

Please sign in to comment.