Xiao Li created SPARK-19601:
-------------------------------

             Summary: Fix CollapseRepartition rule to preserve shuffle-enabled 
Repartition
                 Key: SPARK-19601
                 URL: https://issues.apache.org/jira/browse/SPARK-19601
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 2.1.0, 2.0.2
            Reporter: Xiao Li
            Assignee: Xiao Li


When users use the shuffle-enabled `repartition` API, they expect the partition 
they got should be the exact number they provided, even if they call 
shuffle-disabled `coalesce` later. Currently, `CollapseRepartition` rule does 
not consider whether shuffle is enabled or not. Thus, we got the following 
unexpected result.

{noformat}
    val df = spark.range(0, 10000, 1, 5)
    val df2 = df.repartition(10)
    assert(df2.coalesce(13).rdd.getNumPartitions == 5)
    assert(df2.coalesce(7).rdd.getNumPartitions == 5)
    assert(df2.coalesce(3).rdd.getNumPartitions == 3)
{noformat}




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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

Reply via email to