R/spark_dataframe.R

Defines functions spark_dataframe.spark_jobj spark_dataframe.default spark_dataframe

Documented in spark_dataframe

#' Retrieve a Spark DataFrame
#'
#' This S3 generic is used to access a Spark DataFrame object (as a Java
#' object reference) from an \R object.
#'
#' @param x An \R object wrapping, or containing, a Spark DataFrame.
#' @param ... Optional arguments; currently unused.
#' @return A \code{\link{spark_jobj}} representing a Java object reference
#'   to a Spark DataFrame.
#'
#' @export
spark_dataframe <- function(x, ...) {
  UseMethod("spark_dataframe")
}

#' @export
spark_dataframe.default <- function(x, ...) {
  stop("Unable to retrieve a Spark DataFrame from object of class ",
    paste(class(x), collapse = " "),
    call. = FALSE
  )
}

#' @export
spark_dataframe.spark_jobj <- function(x, ...) {
  x
}

Try the sparklyr package in your browser

Any scripts or data that you put into this service are public.

sparklyr documentation built on Jan. 8, 2022, 5:06 p.m.