LuciferYang commented on code in PR #54446:
URL: https://github.com/apache/spark/pull/54446#discussion_r2846439066


##########
mllib/src/test/scala/org/apache/spark/ml/feature/CountVectorizerSuite.scala:
##########
@@ -350,4 +350,18 @@ class CountVectorizerSuite extends MLTest with 
DefaultReadWriteTest {
         assert(features === Vectors.sparse(0, Seq()))
     }
   }
+
+  test("SPARK-55655: CountVectorizer vocabulary ordering is deterministic for 
tied counts") {
+    val df = Seq(
+      (0, split("a b c d e")),
+      (1, split("e d c b a"))
+    ).toDF("id", "words")
+
+    val cvModel = new CountVectorizer()
+      .setInputCol("words")
+      .setOutputCol("features")
+      .fit(df)
+
+    assert(cvModel.vocabulary === Array("a", "b", "c", "d", "e"))

Review Comment:
   cc @zhengruifeng should a stricter ordering be guaranteed here? I 
encountered failures caused by this when attempting to upgrade Guava to version 
33.5.



-- 
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.

To unsubscribe, e-mail: [email protected]

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