Github user jinxing64 commented on a diff in the pull request:
https://github.com/apache/spark/pull/21330#discussion_r189456451
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/window/WindowExec.scala
---
@@ -213,10 +218,24 @@ case class WindowExec(
(expressions, schema) =>
newMutableProjection(expressions, schema,
subexpressionEliminationEnabled))
+ def createOrdering(): Ordering[InternalRow] = {
+ val exprs = orderSpec.map(_.child)
+ val sortExprs = orderSpec.zipWithIndex.map { case (e, i) =>
+ SortOrder(BoundReference(i, e.dataType, e.nullable),
e.direction)
+ }
+ val ordering = newOrdering(sortExprs, Nil)
+ new Ordering[InternalRow] {
+ override def compare(x: InternalRow, y: InternalRow): Int = {
+ ordering.compare(newMutableProjection(exprs,
child.output)(x),
--- End diff --
I should refine this.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]