From 70161d7582b759dce94389f0de0be35f5040d6f5 Mon Sep 17 00:00:00 2001 From: Kazuyuki Tanimura Date: Mon, 4 Apr 2022 17:42:46 -0700 Subject: [PATCH] [SPARK-38786][SQL][TEST] Bug in StatisticsSuite 'change stats after add/drop partition command' --- .../test/scala/org/apache/spark/sql/hive/StatisticsSuite.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/StatisticsSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/StatisticsSuite.scala index 8afdd50b0c96b..46acc9b2f0a2e 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/StatisticsSuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/StatisticsSuite.scala @@ -976,7 +976,7 @@ class StatisticsSuite extends StatisticsCollectionTestBase with TestHiveSingleto s""" |ALTER TABLE $table ADD |PARTITION (ds='2008-04-09', hr='11') LOCATION '${partDir1.toURI.toString}' - |PARTITION (ds='2008-04-09', hr='12') LOCATION '${partDir1.toURI.toString}' + |PARTITION (ds='2008-04-09', hr='12') LOCATION '${partDir2.toURI.toString}' """.stripMargin) if (autoUpdate) { val fetched2 = checkTableStats(table, hasSizeInBytes = true, expectedRowCounts = None) @@ -999,6 +999,7 @@ class StatisticsSuite extends StatisticsCollectionTestBase with TestHiveSingleto sql(s"ALTER TABLE $table DROP PARTITION (ds='2008-04-08'), PARTITION (hr='12')") assert(spark.sessionState.catalog.listPartitions(TableIdentifier(table)) .map(_.spec).toSet == Set(Map("ds" -> "2008-04-09", "hr" -> "11"))) + assert(partDir1.exists()) // only one partition left if (autoUpdate) { val fetched4 = checkTableStats(table, hasSizeInBytes = true, expectedRowCounts = None)