Github user dongjoon-hyun commented on the issue:

    https://github.com/apache/spark/pull/13765
  
    Hi, All. Here is a better example.
    I'll update the PR description with this.
    Thank you, all.
    
    **Target Scenario**
    ```scala
    scala> val dsView1 = spark.range(8).repartition(8, $"id")
    scala> dsView1.createOrReplaceTempView("dsView1")
    scala> sql("select id from dsView1 distribute by id").explain(true)
    ```
    
    **Before**
    ```scala
    scala> sql("select id from dsView1 distribute by id").explain(true)
    == Parsed Logical Plan ==
    'RepartitionByExpression ['id]
    +- 'Project ['id]
       +- 'UnresolvedRelation `dsView1`
    
    == Analyzed Logical Plan ==
    id: bigint
    RepartitionByExpression [id#0L]
    +- Project [id#0L]
       +- SubqueryAlias dsview1
          +- RepartitionByExpression [id#0L], 8
             +- Range (0, 8, splits=8)
    
    == Optimized Logical Plan ==
    RepartitionByExpression [id#0L]
    +- RepartitionByExpression [id#0L], 8
       +- Range (0, 8, splits=8)
    
    == Physical Plan ==
    Exchange hashpartitioning(id#0L, 200)
    +- Exchange hashpartitioning(id#0L, 8)
       +- *Range (0, 8, splits=8)
    ```
    
    **After**
    ```scala
    scala> sql("select id from dsView1 distribute by id").explain(true)
    == Parsed Logical Plan ==
    'RepartitionByExpression ['id]
    +- 'Project ['id]
       +- 'UnresolvedRelation `dsView1`
    
    == Analyzed Logical Plan ==
    id: bigint
    RepartitionByExpression [id#0L]
    +- Project [id#0L]
       +- SubqueryAlias dsview1
          +- RepartitionByExpression [id#0L], 8
             +- Range (0, 8, splits=8)
    
    == Optimized Logical Plan ==
    RepartitionByExpression [id#0L]
    +- Range (0, 8, splits=8)
    
    == Physical Plan ==
    Exchange hashpartitioning(id#0L, 200)
    +- *Range (0, 8, splits=8)
    ```


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

Reply via email to