<?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 toJSON is not a member of org.apache.spark.sql.SchemaRDD in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/toJSON-is-not-a-member-of-org-apache-spark-sql-SchemaRDD/m-p/119029#M26386</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to read a hive table using HiveContext and built a jar-file using SBT tool. I am getting the below error.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;value toJSON is not a member of org.apache.spark.sql.SchemaRDD&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;But, it works well in spark-shell.&lt;/P&gt;&lt;P&gt;Version:&lt;/P&gt;&lt;P&gt;  Spark 1.2.1&lt;/P&gt;&lt;P&gt;My sbt file has the below content&lt;/P&gt;&lt;P&gt;name := "Simple Project"&lt;/P&gt;&lt;P&gt;version := "1.0"&lt;/P&gt;&lt;P&gt;scalaVersion := "2.10.4"&lt;/P&gt;&lt;P&gt;libraryDependencies += "org.apache.spark" %% "spark-core" % "1.2.1"&lt;/P&gt;&lt;P&gt;libraryDependencies += "org.apache.spark" %% "spark-sql" % "1.0.0"
libraryDependencies += "org.apache.spark" % "spark-hive_2.10" % "1.1.0"&lt;/P&gt;&lt;P&gt;My source code is:&lt;/P&gt;&lt;P&gt;
import org.apache.spark.SparkConf
import org.apache.spark.SparkContext._
import org.apache.spark.SparkContext
import org.apache.spark.sql.hive.HiveContext&lt;/P&gt;&lt;P&gt;object DeptJson {
def main(args:Array[String]) {
val conf = new SparkConf().setAppName("jeeJson")
val sc = new SparkContext(conf)
val hc = new HiveContext(sc)&lt;/P&gt;&lt;P&gt;val dept = hc.sql("select * from departments")&lt;/P&gt;&lt;P&gt;dept.toJSON.saveAsTextFile("dept.json")&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;I'd appreciate if someone could help on this.&lt;/P&gt;&lt;P&gt;Thanks...&lt;/P&gt;</description>
    <pubDate>Wed, 27 Apr 2016 23:57:17 GMT</pubDate>
    <dc:creator>JeevaKrish</dc:creator>
    <dc:date>2016-04-27T23:57:17Z</dc:date>
    <item>
      <title>toJSON is not a member of org.apache.spark.sql.SchemaRDD</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/toJSON-is-not-a-member-of-org-apache-spark-sql-SchemaRDD/m-p/119029#M26386</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to read a hive table using HiveContext and built a jar-file using SBT tool. I am getting the below error.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;value toJSON is not a member of org.apache.spark.sql.SchemaRDD&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;But, it works well in spark-shell.&lt;/P&gt;&lt;P&gt;Version:&lt;/P&gt;&lt;P&gt;  Spark 1.2.1&lt;/P&gt;&lt;P&gt;My sbt file has the below content&lt;/P&gt;&lt;P&gt;name := "Simple Project"&lt;/P&gt;&lt;P&gt;version := "1.0"&lt;/P&gt;&lt;P&gt;scalaVersion := "2.10.4"&lt;/P&gt;&lt;P&gt;libraryDependencies += "org.apache.spark" %% "spark-core" % "1.2.1"&lt;/P&gt;&lt;P&gt;libraryDependencies += "org.apache.spark" %% "spark-sql" % "1.0.0"
libraryDependencies += "org.apache.spark" % "spark-hive_2.10" % "1.1.0"&lt;/P&gt;&lt;P&gt;My source code is:&lt;/P&gt;&lt;P&gt;
import org.apache.spark.SparkConf
import org.apache.spark.SparkContext._
import org.apache.spark.SparkContext
import org.apache.spark.sql.hive.HiveContext&lt;/P&gt;&lt;P&gt;object DeptJson {
def main(args:Array[String]) {
val conf = new SparkConf().setAppName("jeeJson")
val sc = new SparkContext(conf)
val hc = new HiveContext(sc)&lt;/P&gt;&lt;P&gt;val dept = hc.sql("select * from departments")&lt;/P&gt;&lt;P&gt;dept.toJSON.saveAsTextFile("dept.json")&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;I'd appreciate if someone could help on this.&lt;/P&gt;&lt;P&gt;Thanks...&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2016 23:57:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/toJSON-is-not-a-member-of-org-apache-spark-sql-SchemaRDD/m-p/119029#M26386</guid>
      <dc:creator>JeevaKrish</dc:creator>
      <dc:date>2016-04-27T23:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: toJSON is not a member of org.apache.spark.sql.SchemaRDD</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/toJSON-is-not-a-member-of-org-apache-spark-sql-SchemaRDD/m-p/119030#M26387</link>
      <description>&lt;P&gt;In the latest version of Hortonworks sandbox 2.4 (you can download for free from hortonworks.com) zeppelin and spark run out of the box.  Spark version is 1.6 and the toJSON method works, make sure you run it on a DataFrame not RDD&lt;/P&gt;&lt;PRE&gt;val js = tradesRDD.toDF.toJSON
js.take(2)
output:
Array[String] = 
Array({"trader":"Kirk","price":11.0,"qty":51,"vol":40000,"product":"goog","time":"2016-03-29
 10:38:12.0"}, 
{"trader":"Kirk","price":0.0,"qty":66,"vol":40000,"product":"goog","time":"2016-03-29
 10:56:12.0"})&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Apr 2016 01:18:57 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/toJSON-is-not-a-member-of-org-apache-spark-sql-SchemaRDD/m-p/119030#M26387</guid>
      <dc:creator>khaslbeck</dc:creator>
      <dc:date>2016-04-28T01:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: toJSON is not a member of org.apache.spark.sql.SchemaRDD</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/toJSON-is-not-a-member-of-org-apache-spark-sql-SchemaRDD/m-p/119031#M26388</link>
      <description>&lt;P&gt;Hi Kirk Haslbeck,&lt;/P&gt;&lt;P&gt; Thanks for your reply. But, I have to fulfill this through Spark 1.2.1. I greatly appreciate your reply..&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 07:46:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/toJSON-is-not-a-member-of-org-apache-spark-sql-SchemaRDD/m-p/119031#M26388</guid>
      <dc:creator>JeevaKrish</dc:creator>
      <dc:date>2016-04-28T07:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: toJSON is not a member of org.apache.spark.sql.SchemaRDD</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/toJSON-is-not-a-member-of-org-apache-spark-sql-SchemaRDD/m-p/119032#M26389</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/2270/jeevakrishnarg.html" nodeid="2270"&gt;@Jeeva Jeeva&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Your library dependency for SparkSQL looks to be 1.0.0.&lt;/P&gt;&lt;P&gt;libraryDependencies += "org.apache.spark" %% &lt;STRONG&gt;"spark-sql" % "1.0.0"&lt;/STRONG&gt; libraryDependencies += "org.apache.spark" % "spark-hive_2.10" % "1.1.0"&lt;/P&gt;&lt;P&gt;org.apache.spark.rdd.RDD did not acquire the toJson method until 1.2. Load Spark-SQL 1.2 and then give it another try.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 19:43:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/toJSON-is-not-a-member-of-org-apache-spark-sql-SchemaRDD/m-p/119032#M26389</guid>
      <dc:creator>vvaks</dc:creator>
      <dc:date>2016-04-28T19:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: toJSON is not a member of org.apache.spark.sql.SchemaRDD</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/toJSON-is-not-a-member-of-org-apache-spark-sql-SchemaRDD/m-p/119033#M26390</link>
      <description>&lt;P&gt;Thanks for your reply and i will try this and let you know if it works. I greatly appreciate your your effort and time.....&lt;/P&gt;</description>
      <pubDate>Sat, 30 Apr 2016 04:08:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/toJSON-is-not-a-member-of-org-apache-spark-sql-SchemaRDD/m-p/119033#M26390</guid>
      <dc:creator>JeevaKrish</dc:creator>
      <dc:date>2016-04-30T04:08:08Z</dc:date>
    </item>
  </channel>
</rss>

