Uh oh!
There was an error while loading. Please reload this page.
[SPARK-19399][SPARKR] Add R coalesce API for DataFrame and Column - #16739
[SPARK-19399][SPARKR] Add R coalesce API for DataFrame and Column#16739felixcheung wants to merge 6 commits into
Conversation
SparkQA
commented
Jan 30, 2017
Test build #72147 has started for PR 16739 at commit |
felixcheung
commented
Jan 30, 2017
Jenkins, retest this please |
SparkQA
commented
Jan 30, 2017
Test build #72149 has finished for PR 16739 at commit
|
There was a problem hiding this comment.
2.2.0? Or this will be ported back to 2.1.1 too.
There was a problem hiding this comment.
Shall we enforce the input param as Integer?
There was a problem hiding this comment.
it's being coerced into integer - the reason we don't want this to be integer is to allow calls like
coalesce(df, 3)
in which 3 is a numeric by default. (vs 3L is integer) IMO, forcing the user to call with 3L is a bit too much
There was a problem hiding this comment.
addition Columns -> additional Columns?
SparkQA
commented
Jan 30, 2017
Test build #72166 has finished for PR 16739 at commit
|
shivaram
left a comment
There was a problem hiding this comment.
Minor comment on the doc - otherwise looking good. And I can see that the RDD stuff is getting annoying - Will respond on that JIRA
There was a problem hiding this comment.
If there are more partitions then there will be a shuffle right ? Might be useful to add that
There was a problem hiding this comment.
Actually, no, coalesce is set to min(prev partitions, numPartitions) according to CoalescedRDD here so it will be unchanged then.
There was a problem hiding this comment.
Oh well I guess thats worth mentioning then ?
SparkQA
commented
Feb 1, 2017
Test build #72232 has finished for PR 16739 at commit
|
SparkQA
commented
Feb 1, 2017
Test build #72240 has finished for PR 16739 at commit
|
shivaram
commented
Feb 1, 2017
Thanks @felixcheung - I think these changes look good. cc @gatorsmile / @holdenk for doc changes in SQL, Python |
holdenk
left a comment
There was a problem hiding this comment.
So the Python Doc String update looks reasonable, but maybe while we are updating the coalesce docstrings accross the three languages we should consider if we want to include the warning from RDD's coalesce?
There was a problem hiding this comment.
So we seem to have left out the warning from RDD about darastic coaleces in the Dataset coalesce. Since we are updating the docstrings now anyways would it maybe make sense to include that warning here as well? (Looking at the implementation of CoalesceExec it seems like it would still apply unless I'm missing something).
felixcheung
commented
Feb 1, 2017
surely, i think you mean https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/rdd/RDD.scala#L428 |
felixcheung
commented
Feb 1, 2017
and actually I find the current behavior a bit hard to explain, could someone perhaps enlighten me if this is intentional and how best, if we are to, document this behavior? |
holdenk
commented
Feb 1, 2017
@felixcheung I was refering to the ` * However, if you're doing a drastic coalesce, e.g. to numPartitions = 1,
but documentating the coalesce capping out based on numSlices also sounds important to document (and potentially confusing). |
felixcheung
commented
Feb 2, 2017
yap, #16739 (comment) - only RDD has |
gatorsmile
commented
Feb 2, 2017
Thus, I am wondering whether we should allow users to set it to a larger number? Or some advanced users are using it? |
felixcheung
commented
Feb 2, 2017
@gatorsmile thanks for commenting. but, since you are here, do you know why we see this behavior Shouldn't I allow to set partition to 5 < n < 10, since I just |
gatorsmile
commented
Feb 3, 2017
: ) This might be caused by the optimizer rule |
hmm, not as far as I can see: Perhaps during optimization the |
SparkQA
commented
Feb 12, 2017
Test build #72791 has finished for PR 16739 at commit
|
SparkQA
commented
Feb 12, 2017
Test build #72790 has finished for PR 16739 at commit
|
Let me rewrite the test cases in Scala. valdf= spark.range(0, 10000, 1, 5)
assert(df.rdd.getNumPartitions ==5)
assert(df.coalesce(3).rdd.getNumPartitions ==3)
assert(df.coalesce(6).rdd.getNumPartitions ==5)
valdf1= df.coalesce(3)
assert(df1.rdd.getNumPartitions ==3)
assert(df1.coalesce(6).rdd.getNumPartitions ==5)
assert(df1.coalesce(4).rdd.getNumPartitions ==4)
assert(df1.coalesce(2).rdd.getNumPartitions ==2)
valdf2= df.repartition(10)
assert(df2.rdd.getNumPartitions ==10)
assert(df2.coalesce(13).rdd.getNumPartitions ==5)
assert(df2.coalesce(7).rdd.getNumPartitions ==5)
assert(df2.coalesce(3).rdd.getNumPartitions ==3)The question is why the second one is Ok... |
felixcheung
commented
Feb 14, 2017
great, looking forward to that. |
gatorsmile
commented
Feb 14, 2017
The issue is fixed in #16933. If this is merged at first, I will fix the test case in this PR Thanks! : ) |
SparkQA
commented
Feb 15, 2017
Test build #72925 has started for PR 16739 at commit |
felixcheung
commented
Feb 15, 2017
Jenkins, retest this please |
SparkQA
commented
Feb 15, 2017
Test build #72929 has finished for PR 16739 at commit
|
felixcheung
commented
Feb 15, 2017
merged to master and branch-2.1 |
Hi, @felixcheung . |
@dongjoon-hyun my apologies, thanks for bringing this to my attention. I had to hand merge and didn't realize the mismatch. Opened a new PR to fix that. |
dongjoon-hyun
commented
Feb 16, 2017
Thank YOU, always! :) |
## What changes were proposed in this pull request? Add coalesce on DataFrame for down partitioning without shuffle and coalesce on Column ## How was this patch tested? manual, unit tests Author: Felix Cheung <felixcheung_m@hotmail.com> Closesapache#16739 from felixcheung/rcoalesce.
jkbradley
commented
Mar 7, 2017
I've commented elsewhere, but wanted to here just to make more people aware: Let's refrain from backporting new APIs into patch versions unless they are really critical. We do not do this elsewhere in Spark, and we should not in SparkR. New APIs and API changes should only happen in minor versions (and ideally changes will only happen in major ones). It's been discussed elsewhere that SparkR is more experimental than other parts of Spark, but the sooner we start treating it like a stable library, the sooner it will be a stable library. For most people, there isn't a huge difference between getting a new API in a patch version (every 1-2 months) vs. getting it in a minor version (every 4 months). Thanks all! |
…nabled Repartition ### What changes were proposed in this pull request? Observed by felixcheung in #16739, 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. ```Scala 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) ``` This PR is to fix the issue. We preserve shuffle-enabled Repartition. ### How was this patch tested? Added a test case Author: Xiao Li <gatorsmile@gmail.com> Closes#16933 from gatorsmile/CollapseRepartition.
shivaram
commented
Mar 11, 2017
Agree with @jkbradley on this one. We should avoid adding functions that are completely new in a patch release given that the timing between minor versions and patch releases aren't that high. As we discussed in the other thread, lets start tagging JIRAs with |
What changes were proposed in this pull request?
Add coalesce on DataFrame for down partitioning without shuffle and coalesce on Column
How was this patch tested?
manual, unit tests