[
https://issues.apache.org/jira/browse/SPARK-10904?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14940368#comment-14940368
]
Weiqiang Zhuang commented on SPARK-10904:
-----------------------------------------
Yes, list() works. Question is whether or not the c() will be supported. If
not, the document for select should be updated.
There are a couple of errors in the following given example. 1) select(df,
c("col1", "col2")) does not work; 2) the claim of using "$" as a similar method
to select is false, because df$age returns a 'Column' class while select(df,
'age') returns a 'DataFrame' class.
Examples
## Not run:
select(df, "*")
select(df, "col1", "col2")
select(df, df$name, df$age + 1)
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
> select(df, c("col1", "col2")) fails
> -------------------------------------
>
> Key: SPARK-10904
> URL: https://issues.apache.org/jira/browse/SPARK-10904
> Project: Spark
> Issue Type: Bug
> Components: SparkR
> Affects Versions: 1.5.0
> Reporter: Weiqiang Zhuang
>
> The help page for 'select' gives an example of
> select(df, c("col1", "col2"))
> However, this fails with assertion:
> java.lang.AssertionError: assertion failed
> at scala.Predef$.assert(Predef.scala:165)
> at org.apache.spark.api.r.SerDe$.readStringBytes(SerDe.scala:92)
> at org.apache.spark.api.r.SerDe$.readString(SerDe.scala:99)
> at org.apache.spark.api.r.SerDe$.readTypedObject(SerDe.scala:63)
> at org.apache.spark.api.r.SerDe$.readObject(SerDe.scala:52)
> at
> org.apache.spark.api.r.RBackendHandler$$anonfun$readArgs$1.apply(RBackendHandler.scala:182)
> at
> org.apache.spark.api.r.RBackendHandler$$anonfun$readArgs$1.apply(RBackendHandler.scala:181)
> And then none of the functions will work with following error:
> > head(df)
> Error in if (returnStatus != 0) { : argument is of length zero
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]