Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/19800#discussion_r152799244
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateOrdering.scala
---
@@ -72,6 +72,7 @@ object GenerateOrdering extends
CodeGenerator[Seq[SortOrder], Ordering[InternalR
* Generates the code for ordering based on the given order.
*/
def genComparisons(ctx: CodegenContext, ordering: Seq[SortOrder]):
String = {
+ val oldInputRow = ctx.INPUT_ROW
val comparisons = ordering.map { order =>
val oldCurrentVars = ctx.currentVars
--- End diff --
how about
```
val oldInputRow = ...
val oldCurrentVars = ...
val inputRow = "i"
ctx.INPUT_ROW = inputRow
ctx.currentVars = null
val comparisons = ...
ctx.INPUT_ROW = oldInputRow
ctx.currentVars = oldCurrentVars
...
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]