<?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 Re: Unable to run R code to read from Hive Table in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Unable-to-run-R-code-to-read-from-Hive-Table/m-p/57056#M63766</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sparklyr is supported by RStudio, so it may be better to ask this question directory to RStudio or in a forum like StackOverflow. &amp;nbsp; However looking at the code it appears you are passing a string to copy_to rather than a dataframe. &amp;nbsp;If&amp;nbsp;&lt;SPAN&gt;assetstatuses is a dataframe that is available, you can try copying it with copy_to(sc,&amp;nbsp;assetstatuses) without quotes around assetstatuses.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;See:&amp;nbsp;&lt;A href="http://spark.rstudio.com/reference/sparklyr/latest/copy_to.html" target="_blank"&gt;http://spark.rstudio.com/reference/sparklyr/latest/copy_to.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best,&lt;BR /&gt;Tristan&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jul 2017 17:20:10 GMT</pubDate>
    <dc:creator>tristanzajonc</dc:creator>
    <dc:date>2017-07-06T17:20:10Z</dc:date>
    <item>
      <title>Unable to run R code to read from Hive Table</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Unable-to-run-R-code-to-read-from-Hive-Table/m-p/56602#M63765</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to R and after reading a number of articles online, I thought of playing with it in Cloudera Data Science Workbench.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have installed Sparklyr and trying to run the following code:&lt;/P&gt;&lt;P&gt;==========================================================================&amp;nbsp;&lt;/P&gt;&lt;P&gt;library(shiny)&lt;BR /&gt;library(ggplot2)&lt;BR /&gt;library(dygraphs)&lt;BR /&gt;library(circlize)&lt;BR /&gt;library(stringr)&lt;BR /&gt;library(xts)&lt;BR /&gt;library(sparklyr)&lt;BR /&gt;library(dplyr)&lt;/P&gt;&lt;P&gt;installLoadPkgs &amp;lt;- function(pkgList)&lt;BR /&gt;{&lt;BR /&gt;print(pkgList)&lt;BR /&gt;pkgsToLoad &amp;lt;- pkgList[!(pkgList %in% installed.packages()[,"Package"])];&lt;/P&gt;&lt;P&gt;if(length(pkgsToLoad)) {&lt;BR /&gt;install.packages(pkgsToLoad, dependencies = TRUE);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;for(package_name in pkgList) {&lt;BR /&gt;library(package_name, character.only=TRUE, quietly=FALSE);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;# install / load packages&lt;BR /&gt;startTime &amp;lt;- proc.time()&lt;BR /&gt;pkgs &amp;lt;- c("sparklyr", "dplyr", "ggplot2","maps", "geosphere", "DBI", "dygraphs", "circlize", "stringr", "xts")&lt;BR /&gt;proc.time() - startTime&lt;BR /&gt;installLoadPkgs(pkgs)&lt;/P&gt;&lt;P&gt;sc &amp;lt;- spark_connect(master="yarn-client", app_name='manual_monitoring')&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;assetstatuses_tbl &amp;lt;- copy_to(sc, "assetstatuses")&lt;/P&gt;&lt;P&gt;latestAssets_tbl &amp;lt;- assetstatuses_tbl %&amp;gt;%&lt;BR /&gt;filter(createdat &amp;gt; 2017-06-26) %&amp;gt;%&lt;BR /&gt;group_by(assetid, id) %&amp;gt;%&lt;BR /&gt;select(assetid, id)&lt;BR /&gt;sdf_register(latestAssets_tbl, "latestAssets")&lt;/P&gt;&lt;P&gt;====================================================================================&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, it's failing with the following error. Could anyone help me troubleshoot this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="cm-variable"&gt;assetstatuses_tbl&lt;/SPAN&gt; &lt;SPAN class="cm-arrow"&gt;&amp;lt;-&lt;/SPAN&gt; &lt;SPAN class="cm-variable"&gt;copy_to&lt;/SPAN&gt;(&lt;SPAN class="cm-variable"&gt;sc&lt;/SPAN&gt;, &lt;SPAN class="cm-string"&gt;"&lt;/SPAN&gt;&lt;SPAN class="cm-string"&gt;assetstatuses"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;PRE&gt;Error: java.lang.IllegalArgumentException: Invaid type null
	at sparklyr.SQLUtils$.getSQLDataType(sqlutils.scala:60)
	at sparklyr.SQLUtils$.createStructField(sqlutils.scala:65)
	at sparklyr.SQLUtils.createStructField(sqlutils.scala)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at sparklyr.Invoke$.invoke(invoke.scala:94)
	at sparklyr.StreamHandler$.handleMethodCall(stream.scala:89)
	at sparklyr.StreamHandler$.read(stream.scala:55)
	at sparklyr.BackendHandler.channelRead0(handler.scala:49)
	at sparklyr.BackendHandler.channelRead0(handler.scala:14)
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:367)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:353)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:346)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:367)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:353)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:346)
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:367)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:353)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:346)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:367)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:353)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:652)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:575)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:489)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:451)
	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140)
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
	at java.lang.Thread.run(Thread.java:745)
In addition: Warning message:
In as.data.frame.vector(x, ..., nm = nm) :
  'row.names' is not a character vector of length 1 -- omitting it. Will be an error!. &amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2026 13:29:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Unable-to-run-R-code-to-read-from-Hive-Table/m-p/56602#M63765</guid>
      <dc:creator>MGarg</dc:creator>
      <dc:date>2026-04-21T13:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to run R code to read from Hive Table</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Unable-to-run-R-code-to-read-from-Hive-Table/m-p/57056#M63766</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sparklyr is supported by RStudio, so it may be better to ask this question directory to RStudio or in a forum like StackOverflow. &amp;nbsp; However looking at the code it appears you are passing a string to copy_to rather than a dataframe. &amp;nbsp;If&amp;nbsp;&lt;SPAN&gt;assetstatuses is a dataframe that is available, you can try copying it with copy_to(sc,&amp;nbsp;assetstatuses) without quotes around assetstatuses.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;See:&amp;nbsp;&lt;A href="http://spark.rstudio.com/reference/sparklyr/latest/copy_to.html" target="_blank"&gt;http://spark.rstudio.com/reference/sparklyr/latest/copy_to.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best,&lt;BR /&gt;Tristan&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2017 17:20:10 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Unable-to-run-R-code-to-read-from-Hive-Table/m-p/57056#M63766</guid>
      <dc:creator>tristanzajonc</dc:creator>
      <dc:date>2017-07-06T17:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to run R code to read from Hive Table</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Unable-to-run-R-code-to-read-from-Hive-Table/m-p/57733#M63767</link>
      <description>&lt;P&gt;Thanks Tristan!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had found that mistake and corrected it. Thanks for your response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;MG&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2017 17:21:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Unable-to-run-R-code-to-read-from-Hive-Table/m-p/57733#M63767</guid>
      <dc:creator>MGarg</dc:creator>
      <dc:date>2017-07-20T17:21:30Z</dc:date>
    </item>
  </channel>
</rss>

