[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-20 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-149651576
  
Merged build started.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-20 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-149651536
  
 Merged build triggered.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-20 Thread SparkQA
Github user SparkQA commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-149659771
  
**[Test build #1932 has 
started](https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/1932/consoleFull)**
 for PR 9120 at commit 
[`242bfb7`](https://github.com/apache/spark/commit/242bfb7cb421e228903ef07baa1876b55037e4dd).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-20 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-149657290
  
Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-20 Thread davies
Github user davies commented on a diff in the pull request:

https://github.com/apache/spark/pull/9120#discussion_r42531738
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/planning/patterns.scala
 ---
@@ -171,17 +171,25 @@ object ExtractEquiJoinKeys extends Logging with 
PredicateHelper {
   logDebug(s"Considering join on: $condition")
   // Find equi-join predicates that can be evaluated before the join, 
and thus can be used
   // as join keys.
-  val (joinPredicates, otherPredicates) =
-condition.map(splitConjunctivePredicates).getOrElse(Nil).partition 
{
-  case EqualTo(l, r) =>
-(canEvaluate(l, left) && canEvaluate(r, right)) ||
-(canEvaluate(l, right) && canEvaluate(r, left))
-  case _ => false
-}
-
-  val joinKeys = joinPredicates.map {
-case EqualTo(l, r) if canEvaluate(l, left) && canEvaluate(r, 
right) => (l, r)
-case EqualTo(l, r) if canEvaluate(l, right) && canEvaluate(r, 
left) => (r, l)
+  val predicates = 
condition.map(splitConjunctivePredicates).getOrElse(Nil)
--- End diff --

Added.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-20 Thread davies
Github user davies commented on a diff in the pull request:

https://github.com/apache/spark/pull/9120#discussion_r42531676
  
--- Diff: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala 
---
@@ -850,6 +851,15 @@ class SQLQuerySuite extends QueryTest with 
SharedSQLContext {
   Row(null, null, 6, "F") :: Nil)
   }
 
+  test("SPARK-1 null-safe join should not use cartesian product") {
+val df = sql("select count(*) from testData a join testData b on 
(a.key <=> b.key)")
+val cp = df.queryExecution.executedPlan.collect {
+  case cp: CartesianProduct => cp
--- End diff --

added


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-20 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-149657293
  
Test FAILed.
Refer to this link for build results (access rights to CI server needed): 
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44000/
Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-20 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/spark/pull/9120


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-20 Thread SparkQA
Github user SparkQA commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-149691519
  
**[Test build #1932 has 
finished](https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/1932/consoleFull)**
 for PR 9120 at commit 
[`242bfb7`](https://github.com/apache/spark/commit/242bfb7cb421e228903ef07baa1876b55037e4dd).
 * This patch passes all tests.
 * This patch merges cleanly.
 * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-19 Thread marmbrus
Github user marmbrus commented on a diff in the pull request:

https://github.com/apache/spark/pull/9120#discussion_r42433852
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/planning/patterns.scala
 ---
@@ -171,17 +171,25 @@ object ExtractEquiJoinKeys extends Logging with 
PredicateHelper {
   logDebug(s"Considering join on: $condition")
   // Find equi-join predicates that can be evaluated before the join, 
and thus can be used
   // as join keys.
-  val (joinPredicates, otherPredicates) =
-condition.map(splitConjunctivePredicates).getOrElse(Nil).partition 
{
-  case EqualTo(l, r) =>
-(canEvaluate(l, left) && canEvaluate(r, right)) ||
-(canEvaluate(l, right) && canEvaluate(r, left))
-  case _ => false
-}
-
-  val joinKeys = joinPredicates.map {
-case EqualTo(l, r) if canEvaluate(l, left) && canEvaluate(r, 
right) => (l, r)
-case EqualTo(l, r) if canEvaluate(l, right) && canEvaluate(r, 
left) => (r, l)
+  val predicates = 
condition.map(splitConjunctivePredicates).getOrElse(Nil)
--- End diff --

Can you update the scaladoc to include the fact that we transform null-safe 
equality?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-19 Thread marmbrus
Github user marmbrus commented on a diff in the pull request:

https://github.com/apache/spark/pull/9120#discussion_r42434348
  
--- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/joins/InnerJoinSuite.scala
 ---
@@ -212,4 +212,20 @@ class InnerJoinSuite extends SparkPlanTest with 
SharedSQLContext {
 )
   }
 
+  {
+lazy val left = myTestData.where("a = 1")
+lazy val right = myTestData.where("a = 1")
+testInnerJoin(
+  "inner join, null safe",
+  left,
+  right,
+  () => (left.col("a") <=> right.col("a")).expr,
+  Seq(
+(1, 1, 1, 1),
+(1, 1, 1, 2),
+(1, 2, 1, 1),
+(1, 2, 1, 2)
+  )
--- End diff --

Is there anyway we could include data such that it'll break if the original 
predicate is missing?  Maybe something like

```scala
val df = Seq((1, Some(0)), (2, None)).toDF("a", "b")
checkAnswer(
  df.as("x").join(df.as("y"), $"x.b" === $"y.b"),
  Row(1, 0, 1, 0) :: Row(2, null, 2, null) :: Nil)
```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-19 Thread rxin
Github user rxin commented on a diff in the pull request:

https://github.com/apache/spark/pull/9120#discussion_r42435364
  
--- Diff: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala 
---
@@ -850,6 +851,15 @@ class SQLQuerySuite extends QueryTest with 
SharedSQLContext {
   Row(null, null, 6, "F") :: Nil)
   }
 
+  test("SPARK-1 null-safe join should not use cartesian product") {
+val df = sql("select count(*) from testData a join testData b on 
(a.key <=> b.key)")
+val cp = df.queryExecution.executedPlan.collect {
+  case cp: CartesianProduct => cp
--- End diff --

ah one thing about this test case: it might be better to assert the proper 
non-cartesian join operator is in place, rather than testing the cartesian 
product is not in place. The reason I'm bringing this up is that I'm sure as 
soon as we do local iterators (or other operator changes), this test will be a 
no-op (continue passing even if the implementation is wrong).



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-19 Thread marmbrus
Github user marmbrus commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-149365386
  
Two small comments, otherwise LGTM.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-16 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148825207
  
 Merged build triggered.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-16 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148825286
  
Merged build started.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-16 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148826611
  
Merged build started.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-16 Thread SparkQA
Github user SparkQA commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148827457
  
  [Test build #43853 has 
started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43853/consoleFull)
 for   PR 9120 at commit 
[`9337b5a`](https://github.com/apache/spark/commit/9337b5a6b1be86426105ff5f31d1e77fe0962e12).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-16 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148830759
  
Test FAILed.
Refer to this link for build results (access rights to CI server needed): 
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43852/
Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-16 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148830754
  
Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-16 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148826592
  
 Merged build triggered.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-16 Thread SparkQA
Github user SparkQA commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148857675
  
  [Test build #43853 has 
finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43853/console)
 for   PR 9120 at commit 
[`9337b5a`](https://github.com/apache/spark/commit/9337b5a6b1be86426105ff5f31d1e77fe0962e12).
 * This patch **passes all tests**.
 * This patch merges cleanly.
 * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-16 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148857832
  
Test PASSed.
Refer to this link for build results (access rights to CI server needed): 
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43853/
Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-16 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148857830
  
Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-14 Thread SparkQA
Github user SparkQA commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148184825
  
  [Test build #43732 has 
started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43732/consoleFull)
 for   PR 9120 at commit 
[`949c8c3`](https://github.com/apache/spark/commit/949c8c379cd580679ef71820f7d26d8c4a987b83).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-14 Thread rxin
Github user rxin commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148185559
  
Can we add a test that tests the query plan explicitly?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-14 Thread cloud-fan
Github user cloud-fan commented on a diff in the pull request:

https://github.com/apache/spark/pull/9120#discussion_r42049885
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/planning/patterns.scala
 ---
@@ -171,17 +172,24 @@ object ExtractEquiJoinKeys extends Logging with 
PredicateHelper {
   logDebug(s"Considering join on: $condition")
   // Find equi-join predicates that can be evaluated before the join, 
and thus can be used
   // as join keys.
-  val (joinPredicates, otherPredicates) =
-condition.map(splitConjunctivePredicates).getOrElse(Nil).partition 
{
-  case EqualTo(l, r) =>
-(canEvaluate(l, left) && canEvaluate(r, right)) ||
-(canEvaluate(l, right) && canEvaluate(r, left))
-  case _ => false
-}
-
-  val joinKeys = joinPredicates.map {
+  val predicates = 
condition.map(splitConjunctivePredicates).getOrElse(Nil)
+  val joinKeys = predicates.map {
 case EqualTo(l, r) if canEvaluate(l, left) && canEvaluate(r, 
right) => (l, r)
 case EqualTo(l, r) if canEvaluate(l, right) && canEvaluate(r, 
left) => (r, l)
+case EqualNullSafe(l @ AtomicType(), r @ AtomicType())
+  if canEvaluate(l, left) && canEvaluate(r, right) =>
+  (Coalesce(Seq(l, Literal.default(l.dataType))),
+Coalesce(Seq(r, Literal.default(r.dataType
+case EqualNullSafe(l @ AtomicType(), r @ AtomicType())
--- End diff --

Why AtomicType? Looks we only forbid binary type and map type in join 
condition: 
https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala#L91-L104


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-14 Thread rxin
Github user rxin commented on a diff in the pull request:

https://github.com/apache/spark/pull/9120#discussion_r42048273
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/planning/patterns.scala
 ---
@@ -171,17 +172,24 @@ object ExtractEquiJoinKeys extends Logging with 
PredicateHelper {
   logDebug(s"Considering join on: $condition")
   // Find equi-join predicates that can be evaluated before the join, 
and thus can be used
   // as join keys.
-  val (joinPredicates, otherPredicates) =
-condition.map(splitConjunctivePredicates).getOrElse(Nil).partition 
{
-  case EqualTo(l, r) =>
-(canEvaluate(l, left) && canEvaluate(r, right)) ||
-(canEvaluate(l, right) && canEvaluate(r, left))
-  case _ => false
-}
-
-  val joinKeys = joinPredicates.map {
+  val predicates = 
condition.map(splitConjunctivePredicates).getOrElse(Nil)
+  val joinKeys = predicates.map {
 case EqualTo(l, r) if canEvaluate(l, left) && canEvaluate(r, 
right) => (l, r)
 case EqualTo(l, r) if canEvaluate(l, right) && canEvaluate(r, 
left) => (r, l)
+case EqualNullSafe(l @ AtomicType(), r @ AtomicType())
--- End diff --

would be great to add some comment to explain the rewrite


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-14 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148194950
  
Test FAILed.
Refer to this link for build results (access rights to CI server needed): 
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43732/
Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-14 Thread SparkQA
Github user SparkQA commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148194787
  
  [Test build #43732 has 
finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43732/console)
 for   PR 9120 at commit 
[`949c8c3`](https://github.com/apache/spark/commit/949c8c379cd580679ef71820f7d26d8c4a987b83).
 * This patch **fails Spark unit tests**.
 * This patch merges cleanly.
 * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-14 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148182961
  
Merged build started.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-14 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148182936
  
 Merged build triggered.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-14 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148194947
  
Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-14 Thread davies
GitHub user davies opened a pull request:

https://github.com/apache/spark/pull/9120

[SPARK-1] [SQL] fast null-safe join

Currently, we use CartesianProduct for join with null-safe-equal condition.
```
scala> sqlContext.sql("select * from t a join t b on (a.i <=> b.i)").explain
== Physical Plan ==
TungstenProject [i#2,j#3,i#7,j#8]
 Filter (i#2 <=> i#7)
  CartesianProduct
   LocalTableScan [i#2,j#3], [[1,1]]
   LocalTableScan [i#7,j#8], [[1,1]]
```
Actually, we can have an equal-join condition as  `coalesce(i, default) = 
coalesce(b.i, default)`, then an partitioned join algorithm could be used.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/davies/spark null_safe

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/spark/pull/9120.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #9120


commit 949c8c379cd580679ef71820f7d26d8c4a987b83
Author: Davies Liu 
Date:   2015-10-14T20:09:38Z

extract joining key for null safe join




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-14 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148218151
  
 Merged build triggered.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-14 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148218181
  
Merged build started.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-14 Thread SparkQA
Github user SparkQA commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148219916
  
  [Test build #43745 has 
started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43745/consoleFull)
 for   PR 9120 at commit 
[`c2ce6bf`](https://github.com/apache/spark/commit/c2ce6bfd81cf9d9c658b80bbb20e86d4378cc290).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-14 Thread SparkQA
Github user SparkQA commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148242727
  
  [Test build #43745 has 
finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43745/console)
 for   PR 9120 at commit 
[`c2ce6bf`](https://github.com/apache/spark/commit/c2ce6bfd81cf9d9c658b80bbb20e86d4378cc290).
 * This patch **passes all tests**.
 * This patch merges cleanly.
 * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-14 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148242828
  
Test PASSed.
Refer to this link for build results (access rights to CI server needed): 
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43745/
Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-11111] [SQL] fast null-safe join

2015-10-14 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/9120#issuecomment-148242827
  
Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org