Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/8755#discussion_r39899010
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicOperators.scala
---
@@ -68,13 +68,47 @@ case class Generate(
generator.resolved &&
childrenResolved &&
generator.elementTypes.length == generatorOutput.length &&
- !generatorOutput.exists(!_.resolved)
+ generatorOutput.forall(_.resolved)
}
// we don't want the gOutput to be taken as part of the expressions
// as that will cause exceptions like unresolved attributes etc.
override def expressions: Seq[Expression] = generator :: Nil
+ /**
+ * Runs [[transformUp]] with `rule` on all expressions present in this
query operator.
+ * @param rule the rule to be applied to every expression in this
operator.
+ *
+ * Note: This is used by ResolveReferences, we need to override it to
not resolve
+ * `generatorOutput`.
+ */
+ override def transformExpressionsUp(rule: PartialFunction[Expression,
Expression]): this.type = {
+ var changed = false
+
+ @inline def transformExpressionUp(e: Expression): Expression = {
+ val newE = e.transformUp(rule)
+ if (newE.fastEquals(e)) {
+ e
+ } else {
+ changed = true
+ newE
+ }
+ }
+
+ def recursiveTransform(arg: Any): AnyRef = arg match {
--- End diff --
The reason I switched to in way is to isolate the change, because
`expressions.contains(e)` could be expensive for wider tables (there are many
columns). Should we improve the previous one (using lazy val and Set)?
---
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]