MaxGekk commented on a change in pull request #31131:
URL: https://github.com/apache/spark/pull/31131#discussion_r555271036



##########
File path: 
sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/AlterTableRenamePartitionSuite.scala
##########
@@ -46,6 +47,27 @@ trait AlterTableRenamePartitionSuiteBase extends 
command.AlterTableRenamePartiti
       checkAnswer(sql(s"SELECT id, data FROM $t WHERE id = 3"), Row(3, "def"))
     }
   }
+
+  test("SPARK-34060, SPARK-34071: update stats of cached table") {
+    withSQLConf(SQLConf.AUTO_SIZE_UPDATE_ENABLED.key -> "true") {
+      withNamespaceAndTable("ns", "tbl") { t =>
+        sql(s"CREATE TABLE $t (id int, part int) $defaultUsing PARTITIONED BY 
(part)")
+        sql(s"INSERT INTO $t PARTITION (part=0) SELECT 0")
+        sql(s"INSERT INTO $t PARTITION (part=1) SELECT 1")
+        assert(!spark.catalog.isCached(t))
+        sql(s"CACHE TABLE $t")
+        assert(spark.catalog.isCached(t))
+        QueryTest.checkAnswer(sql(s"SELECT * FROM $t"), Seq(Row(0, 0), Row(1, 
1)))
+        val tableSize = getTableSize(t)
+        assert(tableSize > 0)
+
+        sql(s"ALTER TABLE $t PARTITION (part=0) RENAME TO PARTITION (part=2)")
+        assert(spark.catalog.isCached(t))
+        assert(tableSize == getTableSize(t))
+        QueryTest.checkAnswer(sql(s"SELECT * FROM $t"), Seq(Row(0, 2), Row(1, 
1)))

Review comment:
       This is a workaround for the issue which I don't know how to resolve 
something else. If remove `QueryTest`, I am getting the error:
   ```
   An exception or error caused a run to abort: Method 
org/apache/spark/sql/hive/execution/command/AlterTableRenamePartitionSuite.org$apache$spark$sql$execution$command$v1$AlterTableRenamePartitionSuiteBase$$super$checkAnswer(Lscala/Function0;Lscala/collection/Seq;)V
 is abstract 
   java.lang.AbstractMethodError: Method 
org/apache/spark/sql/hive/execution/command/AlterTableRenamePartitionSuite.org$apache$spark$sql$execution$command$v1$AlterTableRenamePartitionSuiteBase$$super$checkAnswer(Lscala/Function0;Lscala/collection/Seq;)V
 is abstract
        at 
org.apache.spark.sql.hive.execution.command.AlterTableRenamePartitionSuite.org$apache$spark$sql$execution$command$v1$AlterTableRenamePartitionSuiteBase$$super$checkAnswer(AlterTableRenamePartitionSuite.scala)
        at 
org.apache.spark.sql.execution.command.v1.AlterTableRenamePartitionSuiteBase.$anonfun$$init$$6(AlterTableRenamePartitionSuite.scala:60)
        at 
org.apache.spark.sql.execution.command.v1.AlterTableRenamePartitionSuiteBase.$anonfun$$init$$6$adapted(AlterTableRenamePartitionSuite.scala:53)
   ```
   
   If you have any ideas how to solve the issue, you are welcome.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to