Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
a367840
[SPARK-10859] [SQL] fix stats of StringType in columnar cache
Sep 28, 2015
9b3014b
[SPARK-10833] [BUILD] Inline, organize BSD/MIT licenses in LICENSE
srowen Sep 29, 2015
d544932
[SPARK-10825] [CORE] [TESTS] Fix race conditions in StandaloneDynamic…
zsxwing Sep 29, 2015
3b23873
[SPARK-10871] include number of executor failures in error msg
ryan-williams Sep 29, 2015
cbc6aec
[SPARK-10058] [CORE] [TESTS] Fix the flaky tests in HeartbeatReceiver…
zsxwing Oct 1, 2015
8836ac3
[SPARK-10904] [SPARKR] Fix to support `select(df, c("col1", "col2"))`
felixcheung Oct 4, 2015
d323e5e
[SPARK-10889] [STREAMING] Bump KCL to add MillisBehindLatest metric
akatz Oct 4, 2015
c8392cd
[SPARK-10934] [SQL] handle hashCode of unsafe array correctly
cloud-fan Oct 6, 2015
6847be6
[SPARK-10901] [YARN] spark.yarn.user.classpath.first doesn't work
Oct 6, 2015
84f510c
[SPARK-10885] [STREAMING] Display the failed output op in Streaming UI
zsxwing Oct 6, 2015
b6a0933
[SPARK-10952] Only add hive to classpath if HIVE_HOME is set.
kevincox Oct 7, 2015
57978ae
[SPARK-10980] [SQL] fix bug in create Decimal
Oct 7, 2015
ba601b1
[SPARK-10914] UnsafeRow serialization breaks when two machines have d…
rxin Oct 9, 2015
3df7500
[SPARK-10955] [STREAMING] Add a warning if dynamic allocation for Str…
harishreedharan Oct 9, 2015
a3b4b93
Merge branch 'branch-1.5' of github.com:apache/spark into csd-1.5
markhamstra Oct 9, 2015
f95129c
[SPARK-10959] [PYSPARK] StreamingLogisticRegressionWithSGD does not t…
BryanCutler Oct 9, 2015
9a625f3
Merge branch 'branch-1.5' of github.com:apache/spark into csd-1.5
markhamstra Oct 9, 2015
5a10e10
[SPARK-10389] [SQL] support order by non-attribute grouping expressio…
cloud-fan Sep 2, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[SPARK-10904] [SPARKR] Fix to support select(df, c("col1", "col2"))
The fix is to coerce `c("a", "b")` into a list such that it could be serialized to call JVM with.

Author: felixcheung <[email protected]>

Closes apache#8961 from felixcheung/rselect.

(cherry picked from commit 721e8b5)
Signed-off-by: Shivaram Venkataraman <[email protected]>
  • Loading branch information
felixcheung authored and shivaram committed Oct 4, 2015
commit 8836ac3d144a1755d796615c75676285adc104cd
14 changes: 11 additions & 3 deletions R/pkg/R/DataFrame.R
Original file line number Diff line number Diff line change
Expand Up @@ -1044,12 +1044,20 @@ setMethod("subset", signature(x = "DataFrame"),
#' select(df, c("col1", "col2"))
#' select(df, list(df$name, df$age + 1))
#' # Similar to R data frames columns can also be selected using `$`
#' df$age
#' df[,df$age]
#' }
setMethod("select", signature(x = "DataFrame", col = "character"),
function(x, col, ...) {
sdf <- callJMethod(x@sdf, "select", col, toSeq(...))
dataFrame(sdf)
if (length(col) > 1) {
if (length(list(...)) > 0) {
stop("To select multiple columns, use a character vector or list for col")
}

select(x, as.list(col))
} else {
sdf <- callJMethod(x@sdf, "select", col, toSeq(...))
dataFrame(sdf)
}
})

#' @rdname select
Expand Down
7 changes: 7 additions & 0 deletions R/pkg/inst/tests/test_sparkSQL.R
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,13 @@ test_that("select with column", {
expect_equal(columns(df3), c("x"))
expect_equal(count(df3), 3)
expect_equal(collect(select(df3, "x"))[[1, 1]], "x")

df4 <- select(df, c("name", "age"))
expect_equal(columns(df4), c("name", "age"))
expect_equal(count(df4), 3)

expect_error(select(df, c("name", "age"), "name"),
"To select multiple columns, use a character vector or list for col")
})

test_that("subsetting", {
Expand Down