Support Questions

Find answers, ask questions, and share your expertise

How to lookup in Hbase using data from Hive in Spark Java

I have a hive table. I am reading it in spark. I want to use one column of dataset and lookup for same in HBase.

How to do it in Spark 2 ?

Note: using Java 8

1 REPLY 1

Rising Star

You can do it in several ways. The easiest one is to read the HBase table with Spark HBase connector (https://github.com/hortonworks-spark/shc) and to join the two dataframes. Another option is to map you dataframe and foreach line perform a Get request to HBase. Here you can find an example of performing a Get request to HBase via Java code.