Skip to content

Commit 9353f0c

Browse files
fix failed tests
1 parent 1da81f2 commit 9353f0c

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

extensions/spark/kyuubi-spark-connector-hive/src/main/scala/org/apache/kyuubi/spark/connector/hive/HiveTableCatalog.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,15 @@ class HiveTableCatalog(sparkSession: SparkSession)
395395
override def dropTable(ident: Identifier): Boolean =
396396
withSparkSQLConf(LEGACY_NON_IDENTIFIER_OUTPUT_CATALOG_NAME -> "true") {
397397
try {
398-
if (loadTable(ident) != null) {
398+
val table = loadTable(ident)
399+
if (table != null) {
399400
catalog.dropTable(
400401
ident.asTableIdentifier,
401402
ignoreIfNotExists = true,
402403
purge = true /* skip HDFS trash */ )
404+
if (table.isInstanceOf[HiveTable]) {
405+
table.asInstanceOf[HiveTable].fileIndex.refresh()
406+
}
403407
true
404408
} else {
405409
false

extensions/spark/kyuubi-spark-connector-hive/src/test/scala/org/apache/kyuubi/spark/connector/hive/HiveFileStatusCacheSuite.scala

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,6 @@ import org.apache.kyuubi.spark.connector.hive.read.HiveFileStatusCache
2828

2929
class HiveFileStatusCacheSuite extends KyuubiHiveTest {
3030

31-
override def beforeEach(): Unit = {
32-
super.beforeEach()
33-
HiveFileStatusCache.resetForTesting()
34-
}
35-
36-
override def afterEach(): Unit = {
37-
super.afterEach()
38-
HiveFileStatusCache.resetForTesting()
39-
}
40-
4131
test("cached by qualifiedName") {
4232
val previousValue = SQLConf.get.getConf(StaticSQLConf.METADATA_CACHE_TTL_SECONDS)
4333
try {

extensions/spark/kyuubi-spark-connector-hive/src/test/scala/org/apache/kyuubi/spark/connector/hive/KyuubiHiveTest.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import org.apache.spark.sql.connector.catalog.{SupportsNamespaces, TableCatalog}
2424
import org.apache.spark.sql.hive.kyuubi.connector.HiveBridgeHelper.Utils
2525

2626
import org.apache.kyuubi.spark.connector.common.LocalSparkSession
27+
import org.apache.kyuubi.spark.connector.hive.read.HiveFileStatusCache
2728

2829
abstract class KyuubiHiveTest extends QueryTest with Logging {
2930

@@ -49,11 +50,13 @@ abstract class KyuubiHiveTest extends QueryTest with Logging {
4950

5051
override def beforeEach(): Unit = {
5152
super.beforeAll()
53+
HiveFileStatusCache.resetForTesting()
5254
getOrCreateSpark()
5355
}
5456

5557
override def afterEach(): Unit = {
5658
super.afterAll()
59+
HiveFileStatusCache.resetForTesting()
5760
LocalSparkSession.stop(innerSpark)
5861
}
5962

0 commit comments

Comments
 (0)