<?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: Error reading/writing to Phoenix table from pyspark in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-reading-writing-to-Phoenix-table-from-pyspark/m-p/202346#M71743</link>
    <description>&lt;P&gt;i changed the localhost to &lt;A href="http://sandbox.hortonworks.com/"&gt;sandbox.hortonworks.com&lt;/A&gt; (that i had in the conf file for zookeper)&lt;/P&gt;&lt;P&gt;code:&lt;/P&gt;&lt;PRE&gt;import phoenix
from pyspark import SparkContext
from pyspark.sql import SQLContext
sc = SparkContext(appName="Phoenix loader")
sqlContext = SQLContext(sc)
table = sqlContext.read.format("org.apache.phoenix.spark").option("table", "INPUT_TABLE").option("zkUrl", "sandbox-hdp.hortonworks.com:2181:/hbase-unsecure").load()&lt;/PRE&gt;&lt;P&gt;but still getting the same error:&lt;/P&gt;&lt;P&gt;17/11/26 11:27:39 INFO MetricsSystemImpl: phoenix metrics system started
Traceback (most recent call last):
  File "/root/hdp/phoenix_test2.py", line 8, in &amp;lt;module&amp;gt;
    table = sqlContext.read.format("org.apache.phoenix.spark").option("table", "INPUT_TABLE").option("zkUrl", "sandbox-hdp.hortonworks.com:2181:/hbase-unsecure").load()
  File "/usr/hdp/current/spark2-client/python/lib/pyspark.zip/pyspark/sql/readwriter.py", line 165, in load
  File "/usr/hdp/current/spark2-client/python/lib/py4j-0.10.4-src.zip/py4j/java_gateway.py", line 1133, in __call__
  File "/usr/hdp/current/spark2-client/python/lib/pyspark.zip/pyspark/sql/utils.py", line 63, in deco
  File "/usr/hdp/current/spark2-client/python/lib/py4j-0.10.4-src.zip/py4j/protocol.py", line 319, in get_return_value
py4j.protocol.Py4JJavaError: An error occurred while calling o42.load.
: java.lang.NoSuchMethodError: org.apache.spark.sql.SQLContext.createDataFrame(Lorg/apache/spark/rdd/RDD;Lorg/apache/spark/sql/types/StructType;)Lorg/apache/spark/sql/DataFrame;
at org.apache.phoenix.spark.PhoenixRDD.toDataFrame(PhoenixRDD.scala:117)&lt;/P&gt;</description>
    <pubDate>Sun, 26 Nov 2017 19:29:43 GMT</pubDate>
    <dc:creator>ztalas1979</dc:creator>
    <dc:date>2017-11-26T19:29:43Z</dc:date>
    <item>
      <title>Error reading/writing to Phoenix table from pyspark</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-reading-writing-to-Phoenix-table-from-pyspark/m-p/202343#M71740</link>
      <description>&lt;P&gt;
	hi,&lt;/P&gt;&lt;P&gt;
	I am trying to put together a data pipeline on HDP 2.6.3 sandbox.(docker) I am using pyspark with phoenix (4.7) and HBase.&lt;/P&gt;&lt;P&gt;
	I have installed phoenix project from maven and successfully created a table with test records. I can see data in Hbase as well.&lt;/P&gt;&lt;P&gt;
	Now i am trying to read data from the table using pyspark with the following code:&lt;/P&gt;
&lt;PRE&gt;import phoenix 
from pyspark import SparkContext
from pyspark.sql import SQLContext
sc = SparkContext(appName="Phoenix test")
sqlContext = SQLContext(sc)
table = sqlContext.read.format("org.apache.phoenix.spark").option("table", "INPUT_TABLE").option("zkUrl", "localhost:2181:/hbase-unsecure").load()
&lt;/PRE&gt;&lt;P&gt;
	phoenix ddl:&lt;/P&gt;
&lt;PRE&gt;CREATE TABLE INPUT_TABLE (id BIGINT NOT NULL PRIMARY KEY, col1 VARCHAR, col2 INTEGER);
UPSERT INTO INPUT_TABLE (id, col1, col2) VALUES (1, 'test_row_1',111);
UPSERT INTO INPUT_TABLE (id, col1, col2) VALUES (2, 'test_row_2',111 );&lt;/PRE&gt;&lt;P&gt;
	call:&lt;/P&gt;
&lt;PRE&gt;spark-submit --verbose --class org.apache.phoenix.spark --jars /usr/hdp/current/phoenix-server/phoenix-4.7.0.2.5.0.0-1245-client.jar &lt;A href="http://repo.hortonworks.com/content/groups/public/" target="_blank"&gt;http://repo.hortonworks.com/content/groups/public/&lt;/A&gt; --files /etc/spark2/conf/hbase-site.xml phoenix_test.py&lt;/PRE&gt;&lt;P&gt;
	error_message:&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):
  File "/root/hdp/process_data.py", line 42, in &amp;lt;module&amp;gt;
    &lt;STRONG&gt;.format(data_source_format)&lt;/STRONG&gt;\
  File "/usr/hdp/current/spark2-client/python/lib/pyspark.zip/pyspark/sql/readwriter.py", line 593, in save
  File "/usr/lib/python2.6/site-packages/py4j-0.10.6-py2.6.egg/py4j/java_gateway.py", line 1160, in __call__
    answer, self.gateway_client, self.target_id, self.name)
  File "/usr/hdp/current/spark2-client/python/lib/pyspark.zip/pyspark/sql/utils.py", line 63, in deco
  File "/usr/lib/python2.6/site-packages/py4j-0.10.6-py2.6.egg/py4j/protocol.py", line 320, in &lt;STRONG&gt;get_return_value
    format(target_id, ".", name), value)
&lt;/STRONG&gt;py4j.protocol.Py4JJavaError: An error occurred while calling o55.save.
: java.lang.UnsupportedOperationException: empty.tail&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;</description>
      <pubDate>Sun, 26 Nov 2017 08:57:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-reading-writing-to-Phoenix-table-from-pyspark/m-p/202343#M71740</guid>
      <dc:creator>ztalas1979</dc:creator>
      <dc:date>2017-11-26T08:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: Error reading/writing to Phoenix table from pyspark</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-reading-writing-to-Phoenix-table-from-pyspark/m-p/202344#M71741</link>
      <description>&lt;P&gt;copied phoenix client and server jars to spark2 and hbase folders as well&lt;/P&gt;&lt;P&gt;and also updated the spark conf file with classes&lt;/P&gt;</description>
      <pubDate>Sun, 26 Nov 2017 08:57:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-reading-writing-to-Phoenix-table-from-pyspark/m-p/202344#M71741</guid>
      <dc:creator>ztalas1979</dc:creator>
      <dc:date>2017-11-26T08:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: Error reading/writing to Phoenix table from pyspark</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-reading-writing-to-Phoenix-table-from-pyspark/m-p/202345#M71742</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/47438/ztalas1979.html" nodeid="47438"&gt;@John Doo&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Apparently the job is unable to pick the table from the zookeeper Znode you have provided. &lt;/P&gt;&lt;P&gt;you have given HBase Zookeeper Znode information for phoenix to retrieve the table information, can you please check the phoenix Znode by changing into just the zookeeper quorum(you can get the precise value from hbase-site.xml file to validate your zookeeper is running on localhost or sandbox.hortonworks.com)&lt;/P&gt;&lt;P&gt;on the other note, Phoenix columns are automatically casted into Capital letters (if you choose to create a view on top of HBase table), hence using the capital letters for both sides (HBase and Phonix side), alternately you may use quotes to resolve this too. &lt;/P&gt;&lt;P&gt;Hope this helps !!&lt;/P&gt;</description>
      <pubDate>Sun, 26 Nov 2017 14:22:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-reading-writing-to-Phoenix-table-from-pyspark/m-p/202345#M71742</guid>
      <dc:creator>bkosaraju</dc:creator>
      <dc:date>2017-11-26T14:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Error reading/writing to Phoenix table from pyspark</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-reading-writing-to-Phoenix-table-from-pyspark/m-p/202346#M71743</link>
      <description>&lt;P&gt;i changed the localhost to &lt;A href="http://sandbox.hortonworks.com/"&gt;sandbox.hortonworks.com&lt;/A&gt; (that i had in the conf file for zookeper)&lt;/P&gt;&lt;P&gt;code:&lt;/P&gt;&lt;PRE&gt;import phoenix
from pyspark import SparkContext
from pyspark.sql import SQLContext
sc = SparkContext(appName="Phoenix loader")
sqlContext = SQLContext(sc)
table = sqlContext.read.format("org.apache.phoenix.spark").option("table", "INPUT_TABLE").option("zkUrl", "sandbox-hdp.hortonworks.com:2181:/hbase-unsecure").load()&lt;/PRE&gt;&lt;P&gt;but still getting the same error:&lt;/P&gt;&lt;P&gt;17/11/26 11:27:39 INFO MetricsSystemImpl: phoenix metrics system started
Traceback (most recent call last):
  File "/root/hdp/phoenix_test2.py", line 8, in &amp;lt;module&amp;gt;
    table = sqlContext.read.format("org.apache.phoenix.spark").option("table", "INPUT_TABLE").option("zkUrl", "sandbox-hdp.hortonworks.com:2181:/hbase-unsecure").load()
  File "/usr/hdp/current/spark2-client/python/lib/pyspark.zip/pyspark/sql/readwriter.py", line 165, in load
  File "/usr/hdp/current/spark2-client/python/lib/py4j-0.10.4-src.zip/py4j/java_gateway.py", line 1133, in __call__
  File "/usr/hdp/current/spark2-client/python/lib/pyspark.zip/pyspark/sql/utils.py", line 63, in deco
  File "/usr/hdp/current/spark2-client/python/lib/py4j-0.10.4-src.zip/py4j/protocol.py", line 319, in get_return_value
py4j.protocol.Py4JJavaError: An error occurred while calling o42.load.
: java.lang.NoSuchMethodError: org.apache.spark.sql.SQLContext.createDataFrame(Lorg/apache/spark/rdd/RDD;Lorg/apache/spark/sql/types/StructType;)Lorg/apache/spark/sql/DataFrame;
at org.apache.phoenix.spark.PhoenixRDD.toDataFrame(PhoenixRDD.scala:117)&lt;/P&gt;</description>
      <pubDate>Sun, 26 Nov 2017 19:29:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-reading-writing-to-Phoenix-table-from-pyspark/m-p/202346#M71743</guid>
      <dc:creator>ztalas1979</dc:creator>
      <dc:date>2017-11-26T19:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: Error reading/writing to Phoenix table from pyspark</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-reading-writing-to-Phoenix-table-from-pyspark/m-p/202347#M71744</link>
      <description>&lt;P&gt;still the same see answer above. can it cause the problem that i installed phoenix on own on sandbox? i just realized that there is a phoenix enabler at hbase on ambari. i just restart my docker image from scratch and use the built in version. is there any  config i should set or enough to enable it and restart hbase? which jar i should use at call the version number one or the phoenix-client.jar one? thanks in advance&lt;/P&gt;&lt;P&gt;checked with the built in phoenix service. the same issue&lt;/P&gt;</description>
      <pubDate>Sun, 26 Nov 2017 23:25:34 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-reading-writing-to-Phoenix-table-from-pyspark/m-p/202347#M71744</guid>
      <dc:creator>ztalas1979</dc:creator>
      <dc:date>2017-11-26T23:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: Error reading/writing to Phoenix table from pyspark</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-reading-writing-to-Phoenix-table-from-pyspark/m-p/202348#M71745</link>
      <description>&lt;P&gt;&lt;A href="https://github.com/tweag/sparkle/issues/105" target="_blank"&gt;https://github.com/tweag/sparkle/issues/105&lt;/A&gt;&lt;/P&gt;&lt;P&gt;it does not seem a zookeeper issue for me. here they discuss about the same error message.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Nov 2017 23:43:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-reading-writing-to-Phoenix-table-from-pyspark/m-p/202348#M71745</guid>
      <dc:creator>ztalas1979</dc:creator>
      <dc:date>2017-11-26T23:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Error reading/writing to Phoenix table from pyspark</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-reading-writing-to-Phoenix-table-from-pyspark/m-p/202349#M71746</link>
      <description>&lt;P&gt;found the issue. It is exactly the same problem mentioned in the below link:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/tweag/sparkle/issues/105"&gt;https://github.com/tweag/sparkle/issues/105&lt;/A&gt;&lt;/P&gt;&lt;P&gt;went back to spark 1.6 and it works&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2017 02:02:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-reading-writing-to-Phoenix-table-from-pyspark/m-p/202349#M71746</guid>
      <dc:creator>ztalas1979</dc:creator>
      <dc:date>2017-11-27T02:02:22Z</dc:date>
    </item>
  </channel>
</rss>

