Invoke a Method on a JVM Object

R/spark_invoke.R

invoke

Description

Invoke methods on Java object references. These functions provide a mechanism for invoking various Java object methods directly from R.

Usage

invoke(jobj, method, ...) 

invoke_static(sc, class, method, ...) 

invoke_new(sc, class, ...) 

Arguments

Arguments Description
jobj An R object acting as a Java object reference (typically, a spark_jobj).
method The name of the method to be invoked.
Optional arguments, currently unused.
sc A spark_connection.
class The name of the Java class whose methods should be invoked.

Details

Use each of these functions in the following scenarios:

Examples

library(sparklyr)
sc <- spark_connect(master = "spark://HOST:PORT") 
spark_context(sc) %>% 
  invoke("textFile", "file.csv", 1L) %>% 
  invoke("count")