title: Querying data from HBase directly into Spark as an RDD, or through Phoenix as a Dataframe?
body: <p>I am trying to query stored data that resides in HBase for use of Spark ML within AWS EMR.  Should I pull the data as an RDD(as attempted below), or should I use Phoenix to try an query the data in as a Dataframe?  </p>
  
  <p>I have attempted both pulling in data into Spark via HBase RDD and through Phoenix.  However I have ran into complications with both methods.  </p>
  
  <pre><code>import org.apache.hadoop.hbase.{ HBaseConfiguration, HColumnDescriptor, HTableDescriptor } 
  import org.apache.hadoop.hbase.client.{ HBaseAdmin, Put, Result, HTable } 
  import org.apache.hadoop.hbase.io.ImmutableBytesWritable 
  import org.apache.hadoop.hbase.mapred.TableOutputFormat 
  import org.apache.hadoop.hbase.mapreduce.TableOutputFormat
  import org.apache.hadoop.hbase.mapreduce.TableInputFormat 
  import org.apache.hadoop.hbase.util.Bytes 
  import org.apache.hadoop.mapred.JobConf 
  import org.apache.hadoop.hbase.client.ConnectionFactory
  import org.apache.hadoop.hbase.client.Result 
  import org.apache.spark.SparkConf 
  import org.apache.spark.SparkContext 
  import org.apache.spark.rdd.{ PairRDDFunctions, RDD } 
  import org.apache.spark.streaming._ 
  import org.apache.spark.streaming.StreamingContext._ 
  import org.apache.spark._
  import org.apache.spark.rdd.NewHadoopRDD
  import org.apache.hadoop.fs.Path
  
  val sparkConf = new SparkConf().setAppName("HBaseGet").setMaster("local[2]")
  
  val sc = new SparkContext(sparkConf)
  val conf = HBaseConfiguration.create()
  val tableName = "test_hbase2"
  
  System.setProperty("user.name", "hdfs")
  System.setProperty("HADOOP_USER_NAME", "hdfs")
  conf.set("hbase.master", "localhost:60000")
  conf.setInt("timeout", 120000)
  conf.set("hbase.zookeeper.quorum", "localhost")
  conf.set("zookeeper.znode.parent", "/hbase-unsecure")
  conf.set(TableInputFormat.INPUT_TABLE, tableName)
  
  conf.set(TableInputFormat.SCAN_ROW_START, "row1");
  conf.set(TableInputFormat.SCAN_ROW_STOP, "row2");
  
  conf.addResource(new Path("/usr/hdp/current/hbase-client/conf/hbase-site.xml"))
  
  println("Number of Records found : " + hBaseRDD.count())
  </code></pre>
  
  <p>Upon execution, I do not get any output, I get the following error:</p>
  
  <pre><code>org.apache.hadoop.hbase.client.RetriesExhaustedException: Can't get the location for replica 0
  </code></pre>