You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by jo...@apache.org on 2016/02/17 09:21:21 UTC

spark git commit: [SPARK-13357][SQL] Use generated projection and ordering for TakeOrderedAndProjectNode

Repository: spark
Updated Branches:
  refs/heads/master 1e1e31e03 -> 04e8afe36


[SPARK-13357][SQL] Use generated projection and ordering for TakeOrderedAndProjectNode

`TakeOrderedAndProjectNode` should use generated projection and ordering like other `LocalNode`s.

Author: Takuya UESHIN <ue...@happy-camper.st>

Closes #11230 from ueshin/issues/SPARK-13357.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/04e8afe3
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/04e8afe3
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/04e8afe3

Branch: refs/heads/master
Commit: 04e8afe362f3bf36097688f9574c66002535ac0f
Parents: 1e1e31e
Author: Takuya UESHIN <ue...@happy-camper.st>
Authored: Wed Feb 17 00:21:15 2016 -0800
Committer: Josh Rosen <jo...@databricks.com>
Committed: Wed Feb 17 00:21:15 2016 -0800

----------------------------------------------------------------------
 .../spark/sql/execution/local/TakeOrderedAndProjectNode.scala | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/04e8afe3/sql/core/src/main/scala/org/apache/spark/sql/execution/local/TakeOrderedAndProjectNode.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/local/TakeOrderedAndProjectNode.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/local/TakeOrderedAndProjectNode.scala
index ae672fb..ca68b76 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/execution/local/TakeOrderedAndProjectNode.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/local/TakeOrderedAndProjectNode.scala
@@ -20,6 +20,7 @@ package org.apache.spark.sql.execution.local
 import org.apache.spark.sql.SQLConf
 import org.apache.spark.sql.catalyst.InternalRow
 import org.apache.spark.sql.catalyst.expressions._
+import org.apache.spark.sql.catalyst.expressions.codegen.GenerateOrdering
 import org.apache.spark.util.BoundedPriorityQueue
 
 case class TakeOrderedAndProjectNode(
@@ -30,7 +31,7 @@ case class TakeOrderedAndProjectNode(
     child: LocalNode) extends UnaryLocalNode(conf) {
 
   private[this] var projection: Option[Projection] = _
-  private[this] var ord: InterpretedOrdering = _
+  private[this] var ord: Ordering[InternalRow] = _
   private[this] var iterator: Iterator[InternalRow] = _
   private[this] var currentRow: InternalRow = _
 
@@ -41,8 +42,8 @@ case class TakeOrderedAndProjectNode(
 
   override def open(): Unit = {
     child.open()
-    projection = projectList.map(new InterpretedProjection(_, child.output))
-    ord = new InterpretedOrdering(sortOrder, child.output)
+    projection = projectList.map(UnsafeProjection.create(_, child.output))
+    ord = GenerateOrdering.generate(sortOrder, child.output)
     // Priority keeps the largest elements, so let's reverse the ordering.
     val queue = new BoundedPriorityQueue[InternalRow](limit)(ord.reverse)
     while (child.next()) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org