Github user sun-rui commented on a diff in the pull request:
https://github.com/apache/spark/pull/8864#discussion_r40635657
--- Diff: R/pkg/R/DataFrame.R ---
@@ -946,15 +946,36 @@ setMethod("foreachPartition",
############################## SELECT ##################################
-getColumn <- function(x, c) {
- column(callJMethod(x@sdf, "col", c))
-}
+#' Select a column
+#'
+#' Selects column based on the column name and return it as a Column.
+#' Note that the column name can also reference to a nested column like
`a.b`.
+#'
+#' @param x A SparkSQL DataFrame
+#'
+#' @rdname select
+#' @name col
+#' @aliases col
+#' @export
+#' @examples
+#'\dontrun{
+#' sc <- sparkR.init()
+#' sqlContext <- sparkRSQL.init(sc)
+#' df <- createDataFrame(sqlContext, list(50, 60, 70), "age")
+#' col(df, "age")
+#'}
+setMethod("col",
--- End diff --
col is a API method of Scala DataFrame, my intention to add it in SparkR is
for API parity. But if it conflicts with existing function in R base package,
and we have alias functions ($ and [[]]), I agree that we can roll such change
back.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]