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


##########
sql/core/src/test/scala/org/apache/spark/sql/DatasetOptimizationSuite.scala:
##########
@@ -32,9 +32,9 @@ class DatasetOptimizationSuite extends QueryTest with 
SharedSparkSession {
   test("SPARK-26619: Prune the unused serializers from SerializeFromObject") {
     val data = Seq(("a", 1), ("b", 2), ("c", 3))
     val ds = data.toDS().map(t => (t._1, t._2 + 1)).select("_1")
-    val serializer = ds.queryExecution.optimizedPlan.collect {
+    val serializer = ds.queryExecution.optimizedPlan.collectFirst {

Review Comment:
   Personally think the following approach might be a bit better:
   
   ```scala
   val serializerOpt = ds.queryExecution.optimizedPlan.collectFirst {
         case s: SerializeFromObject => s
       }
       assert(serializerOpt.isDefined)
       assert(serializerOpt.get.serializer.size == 1)
   ```
   



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to