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”)

example

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

or

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

try hive query in rhive

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

ex

> rhive.query(“show databases”)

close connection

> rhive.close()

Advertisements

2 thoughts on “Connecting R with Hive (RHive)

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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