You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by hvanhovell <gi...@git.apache.org> on 2017/03/10 11:58:18 UTC

[GitHub] spark pull request #17236: [SPARK-19893][SQL] Cannot run intersect/except/di...

Github user hvanhovell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17236#discussion_r105383505
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala ---
    @@ -1703,4 +1703,17 @@ class DataFrameSuite extends QueryTest with SharedSQLContext {
         val df = spark.range(1).selectExpr("CAST(id as DECIMAL) as x").selectExpr("percentile(x, 0.5)")
         checkAnswer(df, Row(BigDecimal(0.0)) :: Nil)
       }
    +
    +  test("SPARK-19893: cannot run intersect/except/distinct with map type") {
    +    val df = spark.range(1).select(map(lit("key"), $"id"))
    +    val e = intercept[AnalysisException](df.intersect(df))
    +    assert(e.message.contains(
    +      "Cannot have map type columns in DataFrame which calls intersect/except/distinct"))
    +    val e2 = intercept[AnalysisException](df.except(df))
    +    assert(e2.message.contains(
    +      "Cannot have map type columns in DataFrame which calls intersect/except/distinct"))
    +    val e3 = intercept[AnalysisException](df.distinct())
    --- End diff --
    
    For some reason I don't understand, the code path for df.distinct() actually creates an aggregate, whereas the SQL code path uses the `Distinct` operator. So we need to actually issue a sql statement here.


---
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