SparkR用什么jar来解析R语法

What jar does SparkR use to parse R syntaxes

我是 SparkR 的新手,所以想问一下 SparkR 使用什么 jar 来解析 R 语法

希望我对您的理解是正确的,您的假设是 R 代码将被翻译成 Java 代码。所以我的简短回答是 SparkR 不使用 jars 来解析 R 语法。

较长的解释:

好吧,SparkR 是用 R 编写的,当您创建 sparkR.session() 时,将创建本地 Spark 驱动程序 JVM,并在您的 R 实例和 JVM 之间建立套接字连接。 SparkR 函数或多或少是用 Scala 编写的 Spark SQL 方法的包装器,这些方法存在于 Spark 端,将使用套接字连接调用。函数参数或整个函数将以自定义格式序列化,发送到 JVM,最终 Spark 执行程序将在 Spark 集群使用的 R 实例中执行(反序列化的)R 代码。

序列化和反序列化代码位于您的 Spark 发行版的 /R/pkg/R/serialize.R/R/pkg/R/deserialize.R 中。 R/pkg/inst/worker/worker.R 在 Spark 集群中执行 R 代码。

An older architecture overview with more details can be found here: https://cs.stanford.edu/~matei/papers/2016/sigmod_sparkr.pdf

There are two kinds of RPCs we support in the SparkR JVM backend: method invocation and creating new objects. Method invocations are called using a reference to an existing Java object (or class name for static methods) and a list of arguments to be passed on to the method. The arguments are serialized using our custom wire format which is then deserialized on the JVM side. We then use Java reflection to invoke the appropriate method. In order to create objects, we use a special method name init and then similarly invoke the appropriate constructor based on the provided arguments. Finally, we use a new R class ’jobj’ that refers to a Java object existing in the backend. These references are tracked on the Java side and are automatically garbage collected when they go out of scope on the R side.