Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/7392#discussion_r34542414
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateOrdering.scala
---
@@ -70,17 +70,27 @@ object GenerateOrdering extends
CodeGenerator[Seq[SortOrder], Ordering[InternalR
"""
}.mkString("\n")
+ val mutableStates = ctx.mutableStates.map {
+ case (jt, name, _) => s"private $jt $name;"
+ }.mkString("\n ")
+
+ val initStates = ctx.mutableStates.zipWithIndex.map {
+ case ((jt, name, _), index) => s"$name = (${ctx.boxedType(jt)})
states[$index];"
+ }.mkString("\n ")
+
val code = s"""
- public SpecificOrdering generate($exprType[] expr) {
- return new SpecificOrdering(expr);
+ public SpecificOrdering generate($exprType[] expr, Object[] states) {
--- End diff --
i'm not worried about performance -- i just think it's ugly and unnecessary
to pass the state around.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]