Github user ConeyLiu commented on a diff in the pull request: https://github.com/apache/spark/pull/19511#discussion_r145041400 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala --- @@ -890,32 +890,39 @@ class Analyzer( /** * Returns true if `exprs` contains a [[Star]]. + * @param deepInto Whether to traverse all the subtrees, true by default. */ - def containsStar(exprs: Seq[Expression]): Boolean = - exprs.exists(_.collect { case _: Star => true }.nonEmpty) + def containsStar(exprs: Seq[Expression], deepInto: Boolean = true): Boolean = { + if (deepInto) { + exprs.exists(_.collect { case _: Star => true }.nonEmpty) + } else { + exprs.exists{ case _: Star => true} + } + } + /** * Expands the matching attribute.*'s in `child`'s output. */ def expandStarExpression(expr: Expression, child: LogicalPlan): Expression = { expr.transformUp { - case f1: UnresolvedFunction if containsStar(f1.children) => + case f1: UnresolvedFunction if containsStar(f1.children, false) => --- End diff -- And aslo I have question: whether we could combine the two traverse into one ? Currently, we first need travese the `children` to test whether there is a `Star`, and then we traverse another one to expand it. We have to go through at least once, and need twice for existed.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org