Skip to content

Commit 7c9fc86

Browse files
committed
[SPARK-32481][FOLLOWUP] Correct testcase
1 parent a8b5688 commit 7c9fc86

File tree

1 file changed

+12
-9
lines changed
  • sql/core/src/test/scala/org/apache/spark/sql/execution/command

1 file changed

+12
-9
lines changed

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3116,16 +3116,17 @@ abstract class DDLSuite extends QueryTest with SQLTestUtils {
31163116
.getTableMetadata(TableIdentifier("tab1")).storage.locationUri.get)
31173117

31183118
val fs = tablePath.getFileSystem(hadoopConf)
3119-
val trashRoot = fs.getTrashRoot(tablePath)
3120-
assert(!fs.exists(trashRoot))
3119+
val trashCurrent = new Path(fs.getTrashRoot(tablePath), "Current")
3120+
val trashPath = Path.mergePaths(trashCurrent, tablePath)
3121+
assert(!fs.exists(trashPath))
31213122
try {
31223123
hadoopConf.set(trashIntervalKey, "5")
31233124
sql("TRUNCATE TABLE tab1")
31243125
} finally {
31253126
hadoopConf.set(trashIntervalKey, originalValue)
31263127
}
3127-
assert(fs.exists(trashRoot))
3128-
fs.delete(trashRoot, true)
3128+
assert(fs.exists(trashPath))
3129+
fs.delete(trashPath, true)
31293130
}
31303131
}
31313132
}
@@ -3144,15 +3145,16 @@ abstract class DDLSuite extends QueryTest with SQLTestUtils {
31443145
.getTableMetadata(TableIdentifier("tab1")).storage.locationUri.get)
31453146

31463147
val fs = tablePath.getFileSystem(hadoopConf)
3147-
val trashRoot = fs.getTrashRoot(tablePath)
3148-
assert(!fs.exists(trashRoot))
3148+
val trashCurrent = new Path(fs.getTrashRoot(tablePath), "Current")
3149+
val trashPath = Path.mergePaths(trashCurrent, tablePath)
3150+
assert(!fs.exists(trashPath))
31493151
try {
31503152
hadoopConf.set(trashIntervalKey, "0")
31513153
sql("TRUNCATE TABLE tab1")
31523154
} finally {
31533155
hadoopConf.set(trashIntervalKey, originalValue)
31543156
}
3155-
assert(!fs.exists(trashRoot))
3157+
assert(!fs.exists(trashPath))
31563158
}
31573159
}
31583160
}
@@ -3167,9 +3169,10 @@ abstract class DDLSuite extends QueryTest with SQLTestUtils {
31673169
.getTableMetadata(TableIdentifier("tab1")).storage.locationUri.get)
31683170

31693171
val fs = tablePath.getFileSystem(hadoopConf)
3170-
val trashRoot = fs.getTrashRoot(tablePath)
3172+
val trashCurrent = new Path(fs.getTrashRoot(tablePath), "Current")
3173+
val trashPath = Path.mergePaths(trashCurrent, tablePath)
31713174
sql("TRUNCATE TABLE tab1")
3172-
assert(!fs.exists(trashRoot))
3175+
assert(!fs.exists(trashPath))
31733176
}
31743177
}
31753178
}

0 commit comments

Comments
 (0)