[MINOR][SQL][TEST] Create table using dataSourceName
in HadoopFsRelationTest
## What changes were proposed in this pull request? This PR fixes a minor issue in `HadoopFsRelationTest`, that you should create table using `dataSourceName` instead of `parquet`. The issue won't affect the correctness, but it will generate wrong error message in case the test fails. ## How was this patch tested? Exsiting tests. Author: Xingbo Jiang <xingbo.jiang@databricks.com> Closes #20780 from jiangxb1987/dataSourceName.
This commit is contained in:
parent
23370554d0
commit
9ddd1e2cea
|
@ -335,16 +335,17 @@ abstract class HadoopFsRelationTest extends QueryTest with SQLTestUtils with Tes
|
|||
|
||||
test("saveAsTable()/load() - non-partitioned table - ErrorIfExists") {
|
||||
withTable("t") {
|
||||
sql("CREATE TABLE t(i INT) USING parquet")
|
||||
intercept[AnalysisException] {
|
||||
sql(s"CREATE TABLE t(i INT) USING $dataSourceName")
|
||||
val msg = intercept[AnalysisException] {
|
||||
testDF.write.format(dataSourceName).mode(SaveMode.ErrorIfExists).saveAsTable("t")
|
||||
}
|
||||
}.getMessage
|
||||
assert(msg.contains("Table `t` already exists"))
|
||||
}
|
||||
}
|
||||
|
||||
test("saveAsTable()/load() - non-partitioned table - Ignore") {
|
||||
withTable("t") {
|
||||
sql("CREATE TABLE t(i INT) USING parquet")
|
||||
sql(s"CREATE TABLE t(i INT) USING $dataSourceName")
|
||||
testDF.write.format(dataSourceName).mode(SaveMode.Ignore).saveAsTable("t")
|
||||
assert(spark.table("t").collect().isEmpty)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue