Repository: spark Updated Branches: refs/heads/branch-1.0 2db77e931 -> 8da0fd869
[SQL] Attribute equality comparisons should be done by exprId. Author: Michael Armbrust <[email protected]> Closes #1414 from marmbrus/exprIdResolution and squashes the following commits: 97b47bc [Michael Armbrust] Attribute equality comparisons should be done by exprId. (cherry picked from commit 502f90782ad474e2630ed5be4d3c4be7dab09c34) Signed-off-by: Michael Armbrust <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/8da0fd86 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/8da0fd86 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/8da0fd86 Branch: refs/heads/branch-1.0 Commit: 8da0fd8691358920138bf90fc4340d55c97a930e Parents: 2db77e9 Author: Michael Armbrust <[email protected]> Authored: Tue Jul 15 17:56:17 2014 -0700 Committer: Michael Armbrust <[email protected]> Committed: Tue Jul 15 17:56:42 2014 -0700 ---------------------------------------------------------------------- .../apache/spark/sql/columnar/InMemoryColumnarTableScan.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/8da0fd86/sql/core/src/main/scala/org/apache/spark/sql/columnar/InMemoryColumnarTableScan.scala ---------------------------------------------------------------------- diff --git a/sql/core/src/main/scala/org/apache/spark/sql/columnar/InMemoryColumnarTableScan.scala b/sql/core/src/main/scala/org/apache/spark/sql/columnar/InMemoryColumnarTableScan.scala index ff7f664..88901de 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/columnar/InMemoryColumnarTableScan.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/columnar/InMemoryColumnarTableScan.scala @@ -96,7 +96,11 @@ private[sql] case class InMemoryColumnarTableScan( new Iterator[Row] { // Find the ordinals of the requested columns. If none are requested, use the first. val requestedColumns = - if (attributes.isEmpty) Seq(0) else attributes.map(relation.output.indexOf(_)) + if (attributes.isEmpty) { + Seq(0) + } else { + attributes.map(a => relation.output.indexWhere(_.exprId == a.exprId)) + } val columnAccessors = requestedColumns.map(columnBuffers(_)).map(ColumnAccessor(_)) val nextRow = new GenericMutableRow(columnAccessors.length)
