This is an automated email from the ASF dual-hosted git repository.

codope pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new 392852cb92b [HUDI-8633] Fix a flaky test for partition stats (#12419)
392852cb92b is described below

commit 392852cb92bf64dfd205d725371d78aae0bffeab
Author: Lin Liu <[email protected]>
AuthorDate: Tue Dec 3 22:42:04 2024 -0800

    [HUDI-8633] Fix a flaky test for partition stats (#12419)
---
 .../org/apache/hudi/functional/TestPartitionStatsIndex.scala      | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/functional/TestPartitionStatsIndex.scala
 
b/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/functional/TestPartitionStatsIndex.scala
index 5d032c68ebe..38be167f319 100644
--- 
a/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/functional/TestPartitionStatsIndex.scala
+++ 
b/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/functional/TestPartitionStatsIndex.scala
@@ -475,9 +475,11 @@ class TestPartitionStatsIndex extends 
PartitionStatsIndexTestBase {
   }
 
   def verifyQueryPredicate(hudiOpts: Map[String, String]): Unit = {
-    val reckey = mergedDfList.last.limit(1).collect().map(row => 
row.getAs("_row_key").toString)
-    val dataFilter = EqualTo(attribute("_row_key"), Literal(reckey(0)))
-    assertEquals(2, spark.sql("select * from " + sqlTempTable + " where " + 
dataFilter.sql).count())
+    val candidateRow = 
mergedDfList.last.groupBy("_row_key").count().limit(1).collect().head
+    val rowKey = candidateRow.getAs[String]("_row_key")
+    val count = candidateRow.getLong(1)
+    val dataFilter = EqualTo(attribute("_row_key"), Literal(rowKey))
+    assertEquals(count, spark.sql("select * from " + sqlTempTable + " where " 
+ dataFilter.sql).count())
     verifyFilePruning(hudiOpts, dataFilter)
   }
 

Reply via email to