hvanhovell commented on code in PR #40651:
URL: https://github.com/apache/spark/pull/40651#discussion_r1160375748
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ordering.scala:
##########
@@ -56,21 +57,12 @@ class InterpretedOrdering(ordering: Seq[SortOrder]) extends
BaseOrdering {
} else if (right == null) {
return if (order.nullOrdering == NullsFirst) 1 else -1
} else {
+ val orderingFunc =
physicalDataTypes(i).ordering.asInstanceOf[Ordering[Any]]
val comparison = order.dataType match {
- case dt: AtomicType if order.direction == Ascending =>
- dt.ordering.asInstanceOf[Ordering[Any]].compare(left, right)
- case dt: AtomicType if order.direction == Descending =>
- - dt.ordering.asInstanceOf[Ordering[Any]].compare(left, right)
- case a: ArrayType if order.direction == Ascending =>
- a.interpretedOrdering.asInstanceOf[Ordering[Any]].compare(left,
right)
- case a: ArrayType if order.direction == Descending =>
- - a.interpretedOrdering.asInstanceOf[Ordering[Any]].compare(left,
right)
- case s: StructType if order.direction == Ascending =>
- s.interpretedOrdering.asInstanceOf[Ordering[Any]].compare(left,
right)
- case s: StructType if order.direction == Descending =>
- - s.interpretedOrdering.asInstanceOf[Ordering[Any]].compare(left,
right)
- case other =>
- throw
QueryExecutionErrors.orderedOperationUnsupportedByDataTypeError(other)
+ case _ if order.direction == Ascending =>
Review Comment:
You can move ascending/descending into the lazy val as well.
--
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]