Uh oh!
There was an error while loading. Please reload this page.
[SPARK-26762][SQL][R] Arrow optimization for conversion from Spark DataFrame to R DataFrame - #23760
[SPARK-26762][SQL][R] Arrow optimization for conversion from Spark DataFrame to R DataFrame#23760HyukjinKwon wants to merge 5 commits into
Conversation
HyukjinKwon
commented
Feb 12, 2019
cc @BryanCutler, @viirya, @felixcheung, @icexelloss, @rxin, @gatorsmile, @shivaram, @falaki, @yanboliang Looks previous |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
HyukjinKwon
commented
Feb 12, 2019
I am going to update |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
SparkQA
commented
Feb 12, 2019
Test build #102242 has finished for PR 23760 at commit
|
SparkQA
commented
Feb 12, 2019
Test build #102249 has finished for PR 23760 at commit
|
Uh oh!
There was an error while loading. Please reload this page.
BryanCutler
commented
Feb 13, 2019
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
HyukjinKwon
commented
Feb 13, 2019
BTW, I am speeding up and planing to make a blog post at Apache Arrow like https://arrow.apache.org/blog/2019/01/25/r-spark-improvements/ (thanks for letting me know @felixcheung). Looks sparklyr added Arrow optimization already. |
HyukjinKwon
commented
Feb 13, 2019
re: #23760 (comment) Thing is, nowadays SparkR doesn't have RDD APIs and in the transition to be removed out completely. Maybe I can try to test with |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
falaki
left a comment
There was a problem hiding this comment.
Thanks for doing this. I did a first pass.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I hope we can go ahead as is if there are not notable comments to avoid conflict hell .. Currently I intentionally didn't start to work some items at #23787 (comment) to avoid conflicts but I am trying to complete all as soon as possible. FWIW, sparklyr already added Arrow optimization, sparklyr#1611 and https://arrow.apache.org/blog/2019/01/25/r-spark-improvements/ |
HyukjinKwon
commented
Feb 18, 2019
gentle ping. Would you guys mind if I go ahead? |
felixcheung
commented
Feb 19, 2019
looks like it's help to break off the remaining tasks in JIRA? #23787 (comment) |
felixcheung
commented
Feb 19, 2019
sorry, clicked wrong |
HyukjinKwon
commented
Feb 19, 2019
Yup, Will add obvious ones first. |
felixcheung
commented
Feb 19, 2019
pending follow ups, ok to me to merge this first. it's getting long to track what should be done and what's changed |
79f204e to
cfe947cCompareHyukjinKwon
commented
Feb 19, 2019
I have added the test, manually ran the tests, created JIRAs under https://issues.apache.org/jira/browse/SPARK-26759 for follow ups. Will get this in soon if there's no more particular comments. |
Uh oh!
There was an error while loading. Please reload this page.
SparkQA
commented
Feb 19, 2019
Test build #102502 has finished for PR 23760 at commit
|
HyukjinKwon
commented
Feb 20, 2019
Merged to master. Thank you all, @BryanCutler, @vanzin, @felixcheung, @viirya, @falaki |
…taFrame to R DataFrame
## What changes were proposed in this pull request?
This PR targets to support Arrow optimization for conversion from Spark DataFrame to R DataFrame.
Like PySpark side, it falls back to non-optimization code path when it's unable to use Arrow optimization.
This can be tested as below:
```bash
$ ./bin/sparkR --conf spark.sql.execution.arrow.enabled=true
```
```r
collect(createDataFrame(mtcars))
```
### Requirements
- R 3.5.x
- Arrow package 0.12+
```bash
Rscript -e 'remotes::install_github("apache/arrowapache-arrow-0.12.0", subdir = "r")'
```
**Note:** currently, Arrow R package is not in CRAN. Please take a look at ARROW-3204.
**Note:** currently, Arrow R package seems not supporting Windows. Please take a look at ARROW-3204.
### Benchmarks
**Shall**
```bash
sync && sudo purge
./bin/sparkR --conf spark.sql.execution.arrow.enabled=false --driver-memory 4g
```
```bash
sync && sudo purge
./bin/sparkR --conf spark.sql.execution.arrow.enabled=true --driver-memory 4g
```
**R code**
```r
df <- cache(createDataFrame(read.csv("500000.csv")))
count(df)
test <- function() {
options(digits.secs = 6) # milliseconds
start.time <- Sys.time()
collect(df)
end.time <- Sys.time()
time.taken <- end.time - start.time
print(time.taken)
}
test()
```
**Data (350 MB):**
```r
object.size(read.csv("500000.csv"))
350379504 bytes
```
"500000 Records" http://eforexcel.com/wp/downloads-16-sample-csv-files-data-sets-for-testing/
**Results**
```
Time difference of 221.32014 secs
```
```
Time difference of 15.51145 secs
```
The performance improvement was around **1426%**.
### Limitations:
- For now, Arrow optimization with R does not support when the data is `raw`, and when user explicitly gives float type in the schema. They produce corrupt values. In this case, we decide to fall back to non-optimization code path.
- Due to ARROW-4512, it cannot send and receive batch by batch. It has to send all batches in Arrow stream format at once. It needs improvement later.
## How was this patch tested?
Existing tests related with Arrow optimization cover this change. Also, manually tested.
Closesapache#23760 from HyukjinKwon/SPARK-26762.
Authored-by: Hyukjin Kwon <gurwls223@apache.org>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>…taFrame to R DataFrame
## What changes were proposed in this pull request?
This PR targets to support Arrow optimization for conversion from Spark DataFrame to R DataFrame.
Like PySpark side, it falls back to non-optimization code path when it's unable to use Arrow optimization.
This can be tested as below:
```bash
$ ./bin/sparkR --conf spark.sql.execution.arrow.enabled=true
```
```r
collect(createDataFrame(mtcars))
```
### Requirements
- R 3.5.x
- Arrow package 0.12+
```bash
Rscript -e 'remotes::install_github("apache/arrowapache-arrow-0.12.0", subdir = "r")'
```
**Note:** currently, Arrow R package is not in CRAN. Please take a look at ARROW-3204.
**Note:** currently, Arrow R package seems not supporting Windows. Please take a look at ARROW-3204.
### Benchmarks
**Shall**
```bash
sync && sudo purge
./bin/sparkR --conf spark.sql.execution.arrow.enabled=false --driver-memory 4g
```
```bash
sync && sudo purge
./bin/sparkR --conf spark.sql.execution.arrow.enabled=true --driver-memory 4g
```
**R code**
```r
df <- cache(createDataFrame(read.csv("500000.csv")))
count(df)
test <- function() {
options(digits.secs = 6) # milliseconds
start.time <- Sys.time()
collect(df)
end.time <- Sys.time()
time.taken <- end.time - start.time
print(time.taken)
}
test()
```
**Data (350 MB):**
```r
object.size(read.csv("500000.csv"))
350379504 bytes
```
"500000 Records" http://eforexcel.com/wp/downloads-16-sample-csv-files-data-sets-for-testing/
**Results**
```
Time difference of 221.32014 secs
```
```
Time difference of 15.51145 secs
```
The performance improvement was around **1426%**.
### Limitations:
- For now, Arrow optimization with R does not support when the data is `raw`, and when user explicitly gives float type in the schema. They produce corrupt values. In this case, we decide to fall back to non-optimization code path.
- Due to ARROW-4512, it cannot send and receive batch by batch. It has to send all batches in Arrow stream format at once. It needs improvement later.
## How was this patch tested?
Existing tests related with Arrow optimization cover this change. Also, manually tested.
Closesapache#23760 from HyukjinKwon/SPARK-26762.
Authored-by: Hyukjin Kwon <gurwls223@apache.org>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
What changes were proposed in this pull request?
This PR targets to support Arrow optimization for conversion from Spark DataFrame to R DataFrame.
Like PySpark side, it falls back to non-optimization code path when it's unable to use Arrow optimization.
This can be tested as below:
collect(createDataFrame(mtcars))Requirements
Rscript -e 'remotes::install_github("apache/arrow@apache-arrow-0.12.0", subdir = "r")'Note: currently, Arrow R package is not in CRAN. Please take a look at ARROW-3204.
Note: currently, Arrow R package seems not supporting Windows. Please take a look at ARROW-3204.
Benchmarks
Shall
sync && sudo purge ./bin/sparkR --conf spark.sql.execution.arrow.enabled=false --driver-memory 4gsync && sudo purge ./bin/sparkR --conf spark.sql.execution.arrow.enabled=true --driver-memory 4gR code
Data (350 MB):
"500000 Records" http://eforexcel.com/wp/downloads-16-sample-csv-files-data-sets-for-testing/
Results
The performance improvement was around 1426%.
Limitations:
For now, Arrow optimization with R does not support when the data is
raw, and when user explicitly gives float type in the schema. They produce corrupt values. In this case, we decide to fall back to non-optimization code path.Due to ARROW-4512, it cannot send and receive batch by batch. It has to send all batches in Arrow stream format at once. It needs improvement later.
How was this patch tested?
Existing tests related with Arrow optimization cover this change. Also, manually tested.