<?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 Spark job reeturns empty rows from HBase in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178082#M80203</link>
    <description>&lt;P&gt;Hi Community,&lt;/P&gt;&lt;P&gt;I'm running a basic spark job which reads from an HBase table.&lt;/P&gt;&lt;P&gt;I can see the job is getting complete without any error, but in output I get the empty rows.&lt;/P&gt;&lt;P&gt;Will appreciate any help.&lt;/P&gt;&lt;P&gt;Below is my code&lt;/P&gt;&lt;PRE&gt;object objectName {
  def catalog = s"""{
         |"table":{"namespace":"namespaceName", "name":"tableName"},
         |"rowkey":"rowKeyAttribute",
         |"columns":{
           |"Key":{"cf":"rowkey", "col":"rowKeyAttribute", "type":"string"},
           |"col1":{"cf":"cfName", "col":"col1", "type":"bigint"},
           |"col2":{"cf":"cfName", "col":"col2", "type":"string"}
          |}
       |}""".stripMargin

  def main(args: Array[String]) {
 
    val spark = SparkSession.builder()
      .appName("dummyApplication")
      .getOrCreate()

    val sc = spark.sparkContext
    val sqlContext = spark.sqlContext   
  
    import sqlContext.implicits._  

    def withCatalog(cat: String): DataFrame = {
      sqlContext
        .read
        .options(Map(HBaseTableCatalog.tableCatalog -&amp;gt; cat))
        .format("org.apache.spark.sql.execution.datasources.hbase")
        .load()
    }


}
&lt;/PRE&gt;</description>
    <pubDate>Tue, 03 Jul 2018 22:17:19 GMT</pubDate>
    <dc:creator>contactvivekjai</dc:creator>
    <dc:date>2018-07-03T22:17:19Z</dc:date>
    <item>
      <title>Spark job reeturns empty rows from HBase</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178082#M80203</link>
      <description>&lt;P&gt;Hi Community,&lt;/P&gt;&lt;P&gt;I'm running a basic spark job which reads from an HBase table.&lt;/P&gt;&lt;P&gt;I can see the job is getting complete without any error, but in output I get the empty rows.&lt;/P&gt;&lt;P&gt;Will appreciate any help.&lt;/P&gt;&lt;P&gt;Below is my code&lt;/P&gt;&lt;PRE&gt;object objectName {
  def catalog = s"""{
         |"table":{"namespace":"namespaceName", "name":"tableName"},
         |"rowkey":"rowKeyAttribute",
         |"columns":{
           |"Key":{"cf":"rowkey", "col":"rowKeyAttribute", "type":"string"},
           |"col1":{"cf":"cfName", "col":"col1", "type":"bigint"},
           |"col2":{"cf":"cfName", "col":"col2", "type":"string"}
          |}
       |}""".stripMargin

  def main(args: Array[String]) {
 
    val spark = SparkSession.builder()
      .appName("dummyApplication")
      .getOrCreate()

    val sc = spark.sparkContext
    val sqlContext = spark.sqlContext   
  
    import sqlContext.implicits._  

    def withCatalog(cat: String): DataFrame = {
      sqlContext
        .read
        .options(Map(HBaseTableCatalog.tableCatalog -&amp;gt; cat))
        .format("org.apache.spark.sql.execution.datasources.hbase")
        .load()
    }


}
&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Jul 2018 22:17:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178082#M80203</guid>
      <dc:creator>contactvivekjai</dc:creator>
      <dc:date>2018-07-03T22:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: Spark job reeturns empty rows from HBase</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178083#M80204</link>
      <description>&lt;P&gt; &lt;A rel="user" href="https://community.cloudera.com/users/73231/contactvivekjain.html" nodeid="73231"&gt;@vivek jain&lt;/A&gt; &lt;/P&gt;&lt;P&gt;I dont see any code making use of withCatalog function. If this function is not beeing used what is the expected output? &lt;/P&gt;&lt;P&gt;As an example perhaps you could try adding something like this to show some of the content of the hbase table:&lt;/P&gt;&lt;PRE&gt;val df = withCatalog(catalog)
df.show()&lt;/PRE&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;*** If you found this answer addressed your question, please take a moment to login and click the "accept" link on the answer.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2018 23:52:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178083#M80204</guid>
      <dc:creator>falbani</dc:creator>
      <dc:date>2018-07-03T23:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: Spark job reeturns empty rows from HBase</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178084#M80205</link>
      <description>&lt;P&gt;Did you check out the docs?&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.6.0/bk_spark-component-guide/content/spark-on-hbase.html" target="_blank"&gt;https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.6.0/bk_spark-component-guide/content/spark-on-hbase.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Did you look at this other HCC post on a similar topic:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.hortonworks.com/questions/49743/read-hbase-table-by-using-sparkscala.html" target="_blank"&gt;https://community.hortonworks.com/questions/49743/read-hbase-table-by-using-sparkscala.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 00:35:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178084#M80205</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-07-04T00:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Spark job reeturns empty rows from HBase</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178085#M80206</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/11048/falbani.html" nodeid="11048"&gt;@Felix Albani&lt;/A&gt; thanks for your response. Please accept my sincere apologies I somehow missed to include that part of the code. I have updated now. &lt;/P&gt;&lt;P&gt;This is the output I see(Please note that I have changed the number of columns in above code, hence the difference).&lt;/P&gt;&lt;P&gt;+----+----+----+----+----+----+----+----+----+
|col4|col7|col1|col3|col6|col0|col8|col2|col5|
+----+----+----+----+----+----+----+----+----+
+----+----+----+----+----+----+----+----+----+
18/07/03 16:16:27 INFO CodeGenerator: Code generated in 10.60842 ms
18/07/03 16:16:27 INFO CodeGenerator: Code generated in 8.990531 ms
+----+
|col0|
+----+
+----+&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 02:15:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178085#M80206</guid>
      <dc:creator>contactvivekjai</dc:creator>
      <dc:date>2018-07-04T02:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: Spark job reeturns empty rows from HBase</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178086#M80207</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/73231/contactvivekjain.html" nodeid="73231"&gt;@vivek jain&lt;/A&gt;&lt;P&gt;Please run the following from HBase shell:&lt;/P&gt;&lt;P&gt;hbase&amp;gt; scan 'tableName', {'LIMIT' =&amp;gt; 5}&lt;/P&gt;&lt;P&gt;Also check what the describe table prints:&lt;/P&gt;&lt;P&gt;bhase&amp;gt; describe ‘tableName’&lt;/P&gt;&lt;P&gt;Make sure you are using case-sensitive name when referencing table from spark code.&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 02:21:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178086#M80207</guid>
      <dc:creator>falbani</dc:creator>
      <dc:date>2018-07-04T02:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Spark job reeturns empty rows from HBase</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178087#M80208</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/11048/falbani.html" nodeid="11048"&gt;@Felix Albani&lt;/A&gt; I have checked these things already.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 04:03:54 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178087#M80208</guid>
      <dc:creator>contactvivekjai</dc:creator>
      <dc:date>2018-07-04T04:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: Spark job reeturns empty rows from HBase</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178088#M80209</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/73231/contactvivekjain.html" nodeid="73231"&gt;@vivek jain&lt;/A&gt; Could you try running the following steps and see if that works:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.hortonworks.com/articles/147327/accessing-hbase-tables-and-querying-on-dataframes.html" target="_blank"&gt;https://community.hortonworks.com/articles/147327/accessing-hbase-tables-and-querying-on-dataframes.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;including table creation?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 04:08:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178088#M80209</guid>
      <dc:creator>falbani</dc:creator>
      <dc:date>2018-07-04T04:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: Spark job reeturns empty rows from HBase</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178089#M80210</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/11048/falbani.html" nodeid="11048"&gt;@Felix Albani&lt;/A&gt; I too really wanted to try this but these libraries are not deployed in cluster instead I create a dependencies jar and then I use it spark-submit.  &lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 04:22:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178089#M80210</guid>
      <dc:creator>contactvivekjai</dc:creator>
      <dc:date>2018-07-04T04:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Spark job reeturns empty rows from HBase</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178090#M80211</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/11048/falbani.html" nodeid="11048"&gt;@Felix Albani&lt;/A&gt; know what, I tried for a table with default namespace. I'm able to view data. Seems its  working for tables without namespace.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 04:51:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178090#M80211</guid>
      <dc:creator>contactvivekjai</dc:creator>
      <dc:date>2018-07-04T04:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: Spark job reeturns empty rows from HBase</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178091#M80212</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/11048/falbani.html" nodeid="11048"&gt;@Felix Albani&lt;/A&gt;
&lt;/P&gt;&lt;P&gt; just found that if I mention table as "table":{"name":"namespace:tablename"} in catalog then it works. Thanks for your time. &lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 05:13:54 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178091#M80212</guid>
      <dc:creator>contactvivekjai</dc:creator>
      <dc:date>2018-07-04T05:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: Spark job reeturns empty rows from HBase</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178092#M80213</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/73231/contactvivekjain.html" nodeid="73231"&gt;@vivek jain&lt;/A&gt; Good to hear that. If you think the answer and followups have helped please take a moment to login and mark as "Accepted" &lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 05:17:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-job-reeturns-empty-rows-from-HBase/m-p/178092#M80213</guid>
      <dc:creator>falbani</dc:creator>
      <dc:date>2018-07-04T05:17:52Z</dc:date>
    </item>
  </channel>
</rss>

