Repository: spark
Updated Branches:
  refs/heads/master 647aeba3a -> c9c89c31b


[SPARK-2965][SQL] Fix HashOuterJoin output nullabilities.

Output attributes of opposite side of `OuterJoin` should be nullable.

Author: Takuya UESHIN <[email protected]>

Closes #1887 from ueshin/issues/SPARK-2965 and squashes the following commits:

bcb2d37 [Takuya UESHIN] Fix HashOuterJoin output nullabilities.


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

Branch: refs/heads/master
Commit: c9c89c31b6114832fe282c21fecd663d8105b9bc
Parents: 647aeba
Author: Takuya UESHIN <[email protected]>
Authored: Mon Aug 11 20:15:01 2014 -0700
Committer: Michael Armbrust <[email protected]>
Committed: Mon Aug 11 20:15:01 2014 -0700

----------------------------------------------------------------------
 .../scala/org/apache/spark/sql/execution/joins.scala   | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/c9c89c31/sql/core/src/main/scala/org/apache/spark/sql/execution/joins.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/joins.scala 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/joins.scala
index 51bb615..ea075f8 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/execution/joins.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/joins.scala
@@ -168,7 +168,18 @@ case class HashOuterJoin(
   override def requiredChildDistribution =
     ClusteredDistribution(leftKeys) :: ClusteredDistribution(rightKeys) :: Nil
 
-  def output = left.output ++ right.output
+  override def output = {
+    joinType match {
+      case LeftOuter =>
+        left.output ++ right.output.map(_.withNullability(true))
+      case RightOuter =>
+        left.output.map(_.withNullability(true)) ++ right.output
+      case FullOuter =>
+        left.output.map(_.withNullability(true)) ++ 
right.output.map(_.withNullability(true))
+      case x =>
+        throw new Exception(s"HashOuterJoin should not take $x as the 
JoinType")
+    }
+  }
 
   // TODO we need to rewrite all of the iterators with our own implementation 
instead of the Scala
   // iterator for performance purpose. 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to