Skip to content

Commit 5a3e5ac

Browse files
committed
modify some code
1 parent 1f2ce17 commit 5a3e5ac

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1985,7 +1985,7 @@ class DDLSuite extends QueryTest with SharedSQLContext with BeforeAndAfterEach {
19851985
val table = spark.sessionState.catalog.getTableMetadata(TableIdentifier("t1"))
19861986
assert(table.location.stripSuffix("/") == dir.getAbsolutePath.stripSuffix("/"))
19871987

1988-
val partDir = new File(dir.getAbsolutePath + "/a=3")
1988+
val partDir = new File(dir, "a=3")
19891989
assert(partDir.exists())
19901990

19911991
checkAnswer(spark.table("t1"), Row(1, 2, 3, 4))

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,8 +1601,7 @@ class HiveDDLSuite
16011601
""".stripMargin)
16021602

16031603
val table = spark.sessionState.catalog.getTableMetadata(TableIdentifier("t"))
1604-
val expectedPath = s"file:${dir.getAbsolutePath.stripSuffix("/")}"
1605-
assert(table.location.stripSuffix("/") == expectedPath)
1604+
assert(table.location.stripSuffix("/") == dir.getAbsolutePath.stripSuffix("/"))
16061605

16071606
checkAnswer(spark.table("t"), Row(3, 4, 1, 2))
16081607
}
@@ -1614,15 +1613,14 @@ class HiveDDLSuite
16141613
|CREATE TABLE t1
16151614
|USING parquet
16161615
|PARTITIONED BY(a, b)
1617-
|LOCATION 'file:$dir'
1616+
|LOCATION '$dir'
16181617
|AS SELECT 3 as a, 4 as b, 1 as c, 2 as d
16191618
""".stripMargin)
16201619

16211620
val table = spark.sessionState.catalog.getTableMetadata(TableIdentifier("t1"))
1622-
val expectedPath = s"file:${dir.getAbsolutePath.stripSuffix("/")}"
1623-
assert(table.location.stripSuffix("/") == expectedPath)
1621+
assert(table.location.stripSuffix("/") == dir.getAbsolutePath.stripSuffix("/"))
16241622

1625-
val partDir = new File(dir.getAbsolutePath + "/a=3")
1623+
val partDir = new File(dir, "a=3")
16261624
assert(partDir.exists())
16271625

16281626
checkAnswer(spark.table("t1"), Row(1, 2, 3, 4))
@@ -1665,7 +1663,7 @@ class HiveDDLSuite
16651663
val expectedPath = s"file:${dir.getAbsolutePath.stripSuffix("/")}"
16661664
assert(table.location.stripSuffix("/") == expectedPath)
16671665

1668-
val partDir = new File(dir.getAbsolutePath + "/a=3")
1666+
val partDir = new File(dir, "a=3")
16691667
assert(partDir.exists())
16701668

16711669
checkAnswer(spark.table("t1"), Row(1, 2, 3, 4))

0 commit comments

Comments
 (0)