cloud-fan commented on code in PR #36697:
URL: https://github.com/apache/spark/pull/36697#discussion_r884557336


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/V2ExpressionUtils.scala:
##########
@@ -54,19 +53,19 @@ object V2ExpressionUtils extends SQLConfHelper with Logging 
{
    * Converts the array of input V2 [[V2SortOrder]] into their counterparts in 
catalyst.
    */
   def toCatalystOrdering(ordering: Array[V2SortOrder], query: LogicalPlan): 
Seq[SortOrder] = {
-    sequenceToOption(ordering.map(toCatalyst(_, 
query))).asInstanceOf[Option[Seq[SortOrder]]]
-      .getOrElse(Seq.empty)
+    ordering.map(toCatalyst(_, query).get.asInstanceOf[SortOrder])
   }
 
   def toCatalyst(
       expr: V2Expression,
       query: LogicalPlan,
+      strict: Boolean = true,

Review Comment:
   instead of adding a new parameter, I think it's clearer and more type-safe 
to have 2 methods
   ```
   def toCatalystOpt ... : Option[Expression]
   def toCatalyst(...): Expression = toCatalystOpt(...).getOrElse(throw error)
   ```



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