Skip to content

Commit a29f493

Browse files
watermenliancheng
authored andcommitted
[SPARK-6397][SQL] Check the missingInput simply
#5082 /cc liancheng Author: Yadong Qi <[email protected]> Closes #5132 from watermen/sql-missingInput-new and squashes the following commits: 1e5bdc5 [Yadong Qi] Check the missingInput simply (cherry picked from commit 9f3273b) Signed-off-by: Cheng Lian <[email protected]>
1 parent 60b9b96 commit a29f493

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,8 @@ class CheckAnalysis {
8585

8686
cleaned.foreach(checkValidAggregateExpression)
8787

88-
case o if o.children.nonEmpty &&
89-
!o.references.filter(_.name != "grouping__id").subsetOf(o.inputSet) =>
90-
val missingAttributes = (o.references -- o.inputSet).map(_.prettyString).mkString(",")
88+
case o if o.children.nonEmpty && o.missingInput.nonEmpty =>
89+
val missingAttributes = o.missingInput.map(_.prettyString).mkString(",")
9190
val input = o.inputSet.map(_.prettyString).mkString(",")
9291

9392
failAnalysis(s"resolved attributes $missingAttributes missing from $input")

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/QueryPlan.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
package org.apache.spark.sql.catalyst.plans
1919

20-
import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeSet, Expression}
20+
import org.apache.spark.sql.catalyst.expressions.{VirtualColumn, Attribute, AttributeSet, Expression}
2121
import org.apache.spark.sql.catalyst.trees.TreeNode
2222
import org.apache.spark.sql.types.{ArrayType, DataType, StructField, StructType}
2323

@@ -48,7 +48,8 @@ abstract class QueryPlan[PlanType <: TreeNode[PlanType]] extends TreeNode[PlanTy
4848
* Subclasses should override this method if they produce attributes internally as it is used by
4949
* assertions designed to prevent the construction of invalid plans.
5050
*/
51-
def missingInput: AttributeSet = references -- inputSet
51+
def missingInput: AttributeSet = (references -- inputSet)
52+
.filter(_.name != VirtualColumn.groupingIdName)
5253

5354
/**
5455
* Runs [[transform]] with `rule` on all expressions present in this query operator.

0 commit comments

Comments
 (0)