<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Please if anyone can give me good examples of HIve Queries used with RSTUDIO. in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Please-if-anyone-can-give-me-good-examples-of-HIve-Queries/m-p/142718#M105311</link>
    <description />
    <pubDate>Thu, 16 Jun 2016 21:52:15 GMT</pubDate>
    <dc:creator>khushikalra_060</dc:creator>
    <dc:date>2016-06-16T21:52:15Z</dc:date>
    <item>
      <title>Please if anyone can give me good examples of HIve Queries used with RSTUDIO.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Please-if-anyone-can-give-me-good-examples-of-HIve-Queries/m-p/142718#M105311</link>
      <description />
      <pubDate>Thu, 16 Jun 2016 21:52:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Please-if-anyone-can-give-me-good-examples-of-HIve-Queries/m-p/142718#M105311</guid>
      <dc:creator>khushikalra_060</dc:creator>
      <dc:date>2016-06-16T21:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Please if anyone can give me good examples of HIve Queries used with RSTUDIO.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Please-if-anyone-can-give-me-good-examples-of-HIve-Queries/m-p/142719#M105312</link>
      <description>&lt;P&gt;There's a really simple example that uses RODBC to query Hive from R.  Should work in RStudio just fine, but you might need to adjust some instructions based on your Hive environment versus the HDInsight example.&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.technet.microsoft.com/meacoex/2014/06/07/connecting-r-to-hdinsight-through-hive/" target="_blank"&gt;https://blogs.technet.microsoft.com/meacoex/2014/06/07/connecting-r-to-hdinsight-through-hive/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2016 23:03:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Please-if-anyone-can-give-me-good-examples-of-HIve-Queries/m-p/142719#M105312</guid>
      <dc:creator>paul_boal</dc:creator>
      <dc:date>2016-06-16T23:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: Please if anyone can give me good examples of HIve Queries used with RSTUDIO.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Please-if-anyone-can-give-me-good-examples-of-HIve-Queries/m-p/142720#M105313</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/2330/khushikalra0602.html" nodeid="2330"&gt;@khushi kalra&lt;/A&gt;&lt;P&gt;You can also use RJDBC as below to connect to Hive:&lt;/P&gt;&lt;P&gt;library("DBI")&lt;/P&gt;&lt;P&gt;library("rJava")&lt;/P&gt;&lt;P&gt;library("RJDBC")&lt;/P&gt;&lt;P&gt;hive.class.path = list.files(path=c("/usr/hdp/current/hive-client/lib"), pattern="jar", full.names=T);&lt;/P&gt;&lt;P&gt;hadoop.lib.path = list.files(path=c("/usr/hdp/current/hive-client/lib"), pattern="jar", full.names=T);&lt;/P&gt;&lt;P&gt;hadoop.class.path = list.files(path=c("/usr/hdp/2.4.0.0-169/hadoop"), pattern="jar", full.names=T);&lt;/P&gt;&lt;P&gt;cp = c(hive.class.path, hadoop.lib.path, hadoop.class.path, "/usr/hdp/2.4.0.0-169/hadoop-mapreduce/hadoop-mapreduce-client-core.jar")&lt;/P&gt;&lt;P&gt;.jinit(classpath=cp)&lt;/P&gt;&lt;P&gt;drv &amp;lt;- JDBC("org.apache.hive.jdbc.HiveDriver","hive-jdbc.jar",identifier.quote="`")&lt;/P&gt;&lt;P&gt;url.dbc &amp;lt;-  paste0("jdbc:hive2://ironhide.hdp.local:10000/default");&lt;/P&gt;&lt;P&gt;conn &amp;lt;- dbConnect(drv, url.dbc, "hive", “redhat");&lt;/P&gt;&lt;P&gt;log4j:WARN No appenders could be found for logger (org.apache.hadoop.util.Shell).&lt;/P&gt;&lt;P&gt;log4j:WARN Please initialize the log4j system properly.&lt;/P&gt;&lt;P&gt;log4j:WARN See &lt;A href="http://logging.apache.org/log4j/1.2/faq.html#noconfig" target="_blank"&gt;http://logging.apache.org/log4j/1.2/faq.html#noconfig&lt;/A&gt; for more info.&lt;/P&gt;&lt;P&gt;dbListTables(conn);&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Sindhu&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2016 23:59:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Please-if-anyone-can-give-me-good-examples-of-HIve-Queries/m-p/142720#M105313</guid>
      <dc:creator>ssubhas</dc:creator>
      <dc:date>2016-06-16T23:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: Please if anyone can give me good examples of HIve Queries used with RSTUDIO.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Please-if-anyone-can-give-me-good-examples-of-HIve-Queries/m-p/142721#M105314</link>
      <description>&lt;P&gt;I have made the connection already, but i want to analyze the data by plotting graphs.can you help me with that.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 03:52:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Please-if-anyone-can-give-me-good-examples-of-HIve-Queries/m-p/142721#M105314</guid>
      <dc:creator>khushikalra_060</dc:creator>
      <dc:date>2016-06-17T03:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: Please if anyone can give me good examples of HIve Queries used with RSTUDIO.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Please-if-anyone-can-give-me-good-examples-of-HIve-Queries/m-p/142722#M105315</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/2330/khushikalra0602.html" nodeid="2330"&gt;@khushi kalra&lt;/A&gt;&lt;P&gt;Take a look at this list of tutorials.  They should get you forward a few more steps.&lt;/P&gt;&lt;P&gt;&lt;A href="http://henning.kropponline.de/2014/07/13/hive-r/" target="_blank"&gt;http://henning.kropponline.de/2014/07/13/hive-r/&lt;/A&gt; &lt;/P&gt;&lt;P&gt;First, this R/JDBC tutorial (or &lt;A rel="user" href="https://community.cloudera.com/users/5019/ssubhas.html" nodeid="5019"&gt;@Sindhu&lt;/A&gt;'s post above) can get you through making a database connection.  From the link above, you can see a couple of lines where this guy pulls data from a table and does a simple plot.&lt;/P&gt;&lt;PRE&gt;sample_08&amp;lt;-dbReadTable(conn,"sample_08")
plot(sample_08$sample_08.salary)&lt;/PRE&gt;&lt;P&gt;You'll probably want to do more sophisticated SQL and plots, though.  &lt;/P&gt;&lt;P&gt;The documentation for RJDBC can be found here: &lt;A href="https://cran.r-project.org/web/packages/RJDBC/index.html" target="_blank"&gt;https://cran.r-project.org/web/packages/RJDBC/index.html&lt;/A&gt;  To run an arbitrary query, you use the dbSendQuery() and dbFetch commands as from this tutorial: &lt;A href="http://www.inside-r.org/packages/cran/DBI/docs/dbGetQuery" target="_blank"&gt;http://www.inside-r.org/packages/cran/DBI/docs/dbGetQuery&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;res &amp;lt;- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4;")
data &amp;lt;- dbFetch(res)&lt;/PRE&gt;&lt;P&gt;Now 'data' will have the results you can plot.&lt;/P&gt;&lt;P&gt;To do any kind of sophisticated plots in R, the typical thing to do is use the 'ggplots' library.  There are lots of tutorials out there.  The connection to what you've done with RJDBC is that the 'data' object above is a dataframe that you can use in building your charts.  Here's one ggplots tutorial: &lt;A href="http://tutorials.iq.harvard.edu/R/Rgraphics/Rgraphics.html" target="_blank"&gt;http://tutorials.iq.harvard.edu/R/Rgraphics/Rgraphics.html&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;hist(data$some.value)
&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Jun 2016 20:24:07 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Please-if-anyone-can-give-me-good-examples-of-HIve-Queries/m-p/142722#M105315</guid>
      <dc:creator>paul_boal</dc:creator>
      <dc:date>2016-06-17T20:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: Please if anyone can give me good examples of HIve Queries used with RSTUDIO.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Please-if-anyone-can-give-me-good-examples-of-HIve-Queries/m-p/142723#M105316</link>
      <description>&lt;P&gt;How would you modify this code to connect to the hortonworks HDP sandbox? I know you have to modify your variables url.dbc and conn, but not quite sure how that would work. Could you please help? &lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 04:45:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Please-if-anyone-can-give-me-good-examples-of-HIve-Queries/m-p/142723#M105316</guid>
      <dc:creator>hlyates</dc:creator>
      <dc:date>2016-07-21T04:45:30Z</dc:date>
    </item>
  </channel>
</rss>

