<?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 How to use sqlContext? Getting an error! in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178489#M140735</link>
    <description>&lt;P&gt; &lt;A href="https://community.cloudera.com/legacyfs/online/attachments/80394-sqlcontext.png"&gt;sqlcontext.png&lt;/A&gt; Please find snapshot attached for the issue.&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jul 2018 17:59:32 GMT</pubDate>
    <dc:creator>sudhir_reddy</dc:creator>
    <dc:date>2018-07-04T17:59:32Z</dc:date>
    <item>
      <title>How to use sqlContext? Getting an error!</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178489#M140735</link>
      <description>&lt;P&gt; &lt;A href="https://community.cloudera.com/legacyfs/online/attachments/80394-sqlcontext.png"&gt;sqlcontext.png&lt;/A&gt; Please find snapshot attached for the issue.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 17:59:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178489#M140735</guid>
      <dc:creator>sudhir_reddy</dc:creator>
      <dc:date>2018-07-04T17:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to use sqlContext? Getting an error!</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178490#M140736</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/83436/sudhirreddy.html" nodeid="83436"&gt;@sudhir reddy&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Are you using Spark2?&lt;/P&gt;&lt;P&gt;Have you set the Env variable as following before opening the shell?&lt;/P&gt;&lt;PRE&gt;# export SPARK_MAJOR_VERSION=2
# spark-shell&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 18:05:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178490#M140736</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2018-07-04T18:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to use sqlContext? Getting an error!</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178491#M140737</link>
      <description>&lt;P&gt;Yes, using spark2. It is by default using Spark2. What else should I try? &lt;A rel="user" href="https://community.cloudera.com/users/3418/jsensharma.html" nodeid="3418"&gt;@Jay Kumar SenSharma&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 18:12:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178491#M140737</guid>
      <dc:creator>sudhir_reddy</dc:creator>
      <dc:date>2018-07-04T18:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use sqlContext? Getting an error!</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178492#M140738</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/83436/sudhirreddy.html" nodeid="83436"&gt;@sudhir reddy&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Can you please share the complete output along with the command that you ran?&lt;BR /&gt;&lt;A rel="user" href="https://community.cloudera.com/users/83436/sudhirreddy.html" nodeid="83436"&gt;&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 18:14:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178492#M140738</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2018-07-04T18:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to use sqlContext? Getting an error!</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178493#M140739</link>
      <description>&lt;P&gt;val rd = sqlContext.read.json("/user/root/Example2.JSON"); //Used this command.&lt;BR /&gt;&lt;BR /&gt;&amp;lt;console&amp;gt;:23: error: not found: value sqlContext
       val rd = sqlContext.read.json("/user/root/Example2.JSON");
                ^ //Got this output     &lt;A rel="user" href="https://community.cloudera.com/users/3418/jsensharma.html" nodeid="3418"&gt;@Jay Kumar SenSharm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 18:18:26 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178493#M140739</guid>
      <dc:creator>sudhir_reddy</dc:creator>
      <dc:date>2018-07-04T18:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to use sqlContext? Getting an error!</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178494#M140740</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/83436/sudhirreddy.html" nodeid="83436"&gt;@sudhir reddy&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;How are you logging in to the Shell?  Which command are you using to login in to the spark shell ? Which mode?&lt;/P&gt;&lt;P&gt;For example when you run "spark-shell" then you will see lots of output ... we need that complete output.&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;PRE&gt;# spark-shell &amp;lt;br&amp;gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;As much information you can provide about your issue ... there are possibilities that your issue will get resolved faster.   Else there will be more interactions to know which HDP version are you using ? What is the logging happening?  ...etc&lt;BR /&gt;&lt;A rel="user" href="https://community.cloudera.com/users/83436/sudhirreddy.html" nodeid="83436"&gt;&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 18:27:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178494#M140740</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2018-07-04T18:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to use sqlContext? Getting an error!</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178495#M140741</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/83436/sudhirreddy.html" nodeid="83436"&gt;@sudhir reddy&lt;/A&gt;&lt;P&gt;SqlContext is not available by default in Spark2 shell. &lt;/P&gt;&lt;P&gt;Create a sqlContext using below statement after launching the spark-shell and then you can read the json using this sqlContext. &lt;/P&gt;&lt;PRE&gt;val sqlContext = new org.apache.spark.sql.SQLContext(sc)&lt;/PRE&gt;&lt;P&gt;Let me know if this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 19:16:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178495#M140741</guid>
      <dc:creator>sandyy006</dc:creator>
      <dc:date>2018-07-04T19:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to use sqlContext? Getting an error!</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178496#M140742</link>
      <description>&lt;PRE&gt;val sc: SparkContext // An existing SparkContext.
val sqlContext = new org.apache.spark.sql.SQLContext(sc)
val rd = sqlContext.read.json("user/root/Example2.JSON")
&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Jul 2018 19:25:12 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178496#M140742</guid>
      <dc:creator>A_Abessi</dc:creator>
      <dc:date>2018-07-04T19:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use sqlContext? Getting an error!</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178497#M140743</link>
      <description>&lt;P&gt;Thanks! It worked.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 20:08:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178497#M140743</guid>
      <dc:creator>sudhir_reddy</dc:creator>
      <dc:date>2018-07-04T20:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to use sqlContext? Getting an error!</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178498#M140744</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 20:09:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178498#M140744</guid>
      <dc:creator>sudhir_reddy</dc:creator>
      <dc:date>2018-07-04T20:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to use sqlContext? Getting an error!</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178499#M140745</link>
      <description>&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 14:36:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-use-sqlContext-Getting-an-error/m-p/178499#M140745</guid>
      <dc:creator>A_Abessi</dc:creator>
      <dc:date>2018-07-05T14:36:17Z</dc:date>
    </item>
  </channel>
</rss>

