3

有谁知道谁将数据从 hive 读取到 R 然后返回到 Hive?
我可以像这样使用 Python 轻松地做到这一点:

for line in sys.stdin:

  Some code ...

  sys.stdout.write(Output + '\n') 

R中有类似的方法吗?

谢谢汤姆

4

2 回答 2

0

if you set up Rstudio on you hive server you can easily access it via R script. You would need the Rhive package. http://cran.r-project.org/web/packages/RHive/

All you need to do after that is set your paths for hadoop and hive home in your R profile and use

library(Rhive)
rhive.init()
rhcon<-rhive.connect(address,port=)

hope that helps!

于 2013-02-21T11:08:42.663 回答
0

Ofir,我想您可以在 R 中以某种方式编写代码。确切地说:

conn <- file("stdin", open="r")
while (length(next.line <- readLines(conn, n=1, warn=FALSE)) > 0) { 
    # processing
    cat(output)
}
于 2014-05-01T22:44:26.963 回答