Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/7593#discussion_r35796020
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
---
@@ -947,6 +948,63 @@ class Analyzer(
Project(p.output, newPlan.withNewChildren(newChild :: Nil))
}
}
+
+ /**
+ * Removes all still-need-evaluate ordering expressions from sort and
use an inner project to
+ * materialize them, finally use a outer project to project them away to
keep the result same.
+ * Then we can make sure we only sort by [[AttributeReference]]s.
+ *
+ * As an example,
+ * {{{
+ * Sort('a, 'b + 1,
+ * Relation('a, 'b))
+ * }}}
+ * will be turned into:
+ * {{{
+ * Project('a, 'b,
+ * Sort('a, '_sortCondition,
+ * Project('a, 'b, ('b + 1).as("_sortCondition"),
+ * Relation('a, 'b))))
+ * }}}
+ */
+ object RemoveEvaluationFromSort extends Rule[LogicalPlan] {
--- End diff --
And you even made it a condition of `resolved` :) !
---
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]