-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-17961][SparkR][SQL] Add storageLevel to DataFrame for SparkR #15516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -783,7 +783,7 @@ test_that("multiple pipeline transformations result in an RDD with the correct v | |
| expect_false(collectRDD(second)[[3]]$testCol) | ||
| }) | ||
|
|
||
| test_that("cache(), persist(), and unpersist() on a DataFrame", { | ||
| test_that("cache(), storageLevel(), persist(), and unpersist() on a DataFrame", { | ||
| df <- read.json(jsonPath) | ||
| expect_false(df@env$isCached) | ||
| cache(df) | ||
|
|
@@ -795,6 +795,8 @@ test_that("cache(), persist(), and unpersist() on a DataFrame", { | |
| persist(df, "MEMORY_AND_DISK") | ||
| expect_true(df@env$isCached) | ||
|
|
||
| expect_equal(storageLevel(df), "StorageLevel(disk, memory, deserialized, 1 replicas)") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so the output of this doesn't say "MEMORY_AND_DISK"? Should we have that in addition to "StorageLevel(disk, memory, deserialized, 1 replicas)"? It might be confusing to set "MEMORY_AND_DISK" and get "StorageLevel(disk, memory, deserialized, 1 replicas)" back?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good suggestion, I'll update the code later. thanks! |
||
|
|
||
| unpersist(df) | ||
| expect_false(df@env$isCached) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hardcoding the variations in R could be hard to maintain or easily get out of sync. is there anyway to do this?
Python seems to be able to get the enum name as a string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python has itself
StorageLevelclass, and the python side code aboutstorageLevelalso exists duplicated code problem...and if we make an r-side
StorageLevelclass may cause the code more complex and seems won't help solving the duplicated code problem.What do you think about it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and, about the R-side String constant, is there better way to avoid duplicated literal constant in code ? such as "MEMORY_AND_DISK", does we need to define some global vars, such as
MEMORY_AND_DISK_CONSTANT <- "MEMORY_AND_DISK" ?
and where could we put the definition above? if use this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Class in R wouldn't help much in this case.
You could have a look up table - check out https://github.com/apache/spark/blob/master/R/pkg/R/types.R and how it is used