spark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marmb...@apache.org
Subject git commit: [SQL]Add base row updating methods for JoinedRow
Date Wed, 25 Jun 2014 02:07:16 GMT
Repository: spark
Updated Branches:
  refs/heads/master 8ca41769f -> 133495d82


[SQL]Add base row updating methods for JoinedRow

This will be helpful in join operators.

Author: Cheng Hao <hao.cheng@intel.com>

Closes #1187 from chenghao-intel/joinedRow and squashes the following commits:

87c19e3 [Cheng Hao] Add base row set methods for JoinedRow


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

Branch: refs/heads/master
Commit: 133495d82672c3f34d40a6298cc80c31f91faf5c
Parents: 8ca4176
Author: Cheng Hao <hao.cheng@intel.com>
Authored: Tue Jun 24 19:07:02 2014 -0700
Committer: Michael Armbrust <michael@databricks.com>
Committed: Tue Jun 24 19:07:02 2014 -0700

----------------------------------------------------------------------
 .../sql/catalyst/expressions/Projection.scala      | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/133495d8/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Projection.scala
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Projection.scala
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Projection.scala
index c9b7cea..a9e976c 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Projection.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Projection.scala
@@ -81,6 +81,18 @@ class JoinedRow extends Row {
     this
   }
 
+  /** Updates this JoinedRow by updating its left base row.  Returns itself. */
+  def withLeft(newLeft: Row): Row = {
+    row1 = newLeft
+    this
+  }
+
+  /** Updates this JoinedRow by updating its right base row.  Returns itself. */
+  def withRight(newRight: Row): Row = {
+    row2 = newRight
+    this
+  }
+
   def iterator = row1.iterator ++ row2.iterator
 
   def length = row1.length + row2.length
@@ -124,4 +136,9 @@ class JoinedRow extends Row {
     }
     new GenericRow(copiedValues)
   }
+
+  override def toString() = {
+    val row = (if (row1 != null) row1 else Seq[Any]()) ++ (if (row2 != null) row2 else Seq[Any]())
+    s"[${row.mkString(",")}]"
+  }
 }


Mime
View raw message