Connecting R with Hive (RHive)

Previously, you have to install Rhive package in R, you can follow this post

Running RHive

In the R Console

> library(RHive)
> Sys.setenv(HIVE_HOME=”/usr/local/hive”)
> Sys.setenv(HADOOP_HOME=”/usr/local/hadoop”)
> rhive.init()
> rhive.connect(“ipaddress of hive server”)


> rhive.connect(“localhost”)
> rhive.connect(“


> rhiveConnection<-rhive.connect(“ipaddress of hive server”)
> rhive.init()

try hive query in rhive

> rhive.query(“<hiveQL-query>”)


> rhive.query(“show databases”)

close connection

> rhive.close()


2 thoughts on “Connecting R with Hive (RHive)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s