Skip to content

Commit

Permalink
For comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed Jun 30, 2015
1 parent 913f6ad commit 5c314c1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ trait HiveTypeCoercion {
case q: LogicalPlan if !q.childrenResolved => q

case q: LogicalPlan =>
val inputMap = q.inputSet.toAttributeMap(a => a)
val inputMap = q.inputSet.toSeq.map(a => (a.exprId, a)).toMap
q transformExpressions {
case a: AttributeReference =>
inputMap.get(a) match {
inputMap.get(a.exprId) match {
// This can happen when a Attribute reference is born in a non-leaf node, for example
// due to a call to an external script like in the Transform operator.
// TODO: Perhaps those should actually be aliases?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,6 @@ class AttributeSet private (val baseSet: Set[AttributeEquals])
def intersect(other: AttributeSet): AttributeSet =
new AttributeSet(baseSet.intersect(other.baseSet))

/**
* Returns a new [[AttributeMap]] that uses [[Attribute.exprId]] as key. The value of this map is
* [[(Attribute, A)]] where type [[A]] is given by the parameter function [[f]].
*/
def toAttributeMap[A](f: (Attribute) => A): AttributeMap[A] = {
AttributeMap(this.toSeq.map(a => (a, f(a))))
}

override def foreach[U](f: (Attribute) => U): Unit = baseSet.map(_.a).foreach(f)

// We must force toSeq to not be strict otherwise we end up with a [[Stream]] that captures all
Expand Down

0 comments on commit 5c314c1

Please sign in to comment.