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


##########
sql/core/src/test/scala/org/apache/spark/sql/DatasetOptimizationSuite.scala:
##########
@@ -45,9 +46,9 @@ class DatasetOptimizationSuite extends QueryTest with 
SharedSparkSession {
   // serializers. The first `structFields` is aligned with first serializer 
and ditto
   // for other `structFields`.
   private def testSerializer(df: DataFrame, structFields: Seq[Seq[String]]*): 
Unit = {
-    val serializer = df.queryExecution.optimizedPlan.collect {
+    val serializer = df.queryExecution.optimizedPlan.collectFirst {
       case s: SerializeFromObject => s
-    }.head
+    }.get

Review Comment:
   Just like in the previous case, I suggest changing it to 
   
   ```
   val serializerOpt = df.queryExecution.optimizedPlan.collectFirst {
         case s: SerializeFromObject => s
       }
   assert(serializerOpt.isDefined)
   val serializer = serializerOpt.get
   ```
   
   
   
   



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