我是 R Hadoop 的新手。我能够使用 Hadoop 运行 rmr 包的 map reduce 功能。基本上在后台 R 在 Java 中运行这个映射减少代码。意思是R把这个R的map reduce代码转成Java,所以能不能在运行map reduce的时候得到java后台代码。
谁能帮帮我?
最佳答案
在Rhadoop中,R并没有将R Map Reduce代码转换为java。Rhadoop提供了MapReduce接口(interface); mapper 和 reducer 可以用 R 代码描述,然后从 R 中调用。
Rhadoop package will submit R code to Hadoop Cluster using Hadoop streaming.Hadoop streaming is a utility that comes with the Hadoop distribution. The utility allows you to create and run Map/Reduce jobs with any executable or script as the mapper and/or the reducer.
您可以通过查看 GitHub 中的 Rhadoop 包代码来了解这一点。 .
RHadoop 包使用 R 中的 System 命令提交 hadoop 流作业。 你可以从这个 R scipt 得到一个想法在 RMR 包中。该 streaming.R 中的代码如下所示。
final.command =
paste(
hadoop.command,
stream.mapred.io,
if(is.null(backend.parameters)) ""
else
do.call(paste.options, backend.parameters),
input,
output,
mapper,
combiner,
reducer,
image.cmd.line,
m.fl,
r.fl,
c.fl,
input.format.opt,
output.format.opt,
"2>&1")
if(verbose) {
retval = system(final.command)
if (retval != 0) stop("hadoop streaming failed with error code ", retval, "\n")}
else {
console.output = tryCatch(system(final.command, intern=TRUE),
warning = function(e) stop(e))
0}}
关于r - 如何在Rhadoop中的rmr map reduce中捕获R后台代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20417434/