spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From frreiss <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-15370] [SQL] Update RewriteCorrelatedSc...
Date Wed, 18 May 2016 19:38:30 GMT
Github user frreiss commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13155#discussion_r63767862
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala ---
    @@ -293,4 +293,65 @@ class SubquerySuite extends QueryTest with SharedSQLContext {
             """.stripMargin),
           Row(3) :: Nil)
       }
    +
    +  test("COUNT bug in WHERE clause (Filter)") {
    +
    +    // Case 1: Canonical example of the COUNT bug
    +    checkAnswer(
    +      sql("select l.a from l where (select count(*) from r where l.a = r.c) < l.a"),
    +      Row(1) :: Row(1) :: Row(3) :: Row(6) :: Nil)
    +
    +    // Case 2: count(*) = 0; could be rewritten to NOT EXISTS but currently uses
    +    // a rewrite that is vulnerable to the COUNT bug
    +    checkAnswer(
    +      sql("select l.a from l where (select count(*) from r where l.a = r.c) = 0"),
    +      Row(1) :: Row(1) :: Row(null) :: Row(null) :: Nil)
    +
    +    // Case 3: COUNT bug without a COUNT aggregate
    +    checkAnswer(
    +      sql("select l.a from l where (select sum(r.d) is null from r where l.a = r.c)"),
    +      Row(1) :: Row(1) ::Row(null) :: Row(null) :: Row(6) :: Nil)
    +
    --- End diff --
    
    Will do.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message