Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to create Single DataFrame for multiple Phoenix (HBase tables) in Java ?

How to create Single DataFrame for multiple Phoenix (HBase tables) in Java ?

New Contributor

Hi,

I have a scenario where I have multiple HBase tables on Phoenix and I have to create a single dataframe from these multiple Phoenix tables? Can anyone please provide me the solution to achieve this using Java ?

2 REPLIES 2

Re: How to create Single DataFrame for multiple Phoenix (HBase tables) in Java ?

you can read the data from Phoenix using phoenix-spark connector and the using spark native APIs , you can join (or union) those data frames into single data frame.

Re: How to create Single DataFrame for multiple Phoenix (HBase tables) in Java ?

New Contributor

Thanks, I have already used this approach.

Dataset<Row> df = null;

Dataset<Row> hbaseDf = null;

for (number of hbase tables){

hbaseDf = createDataFrameFromHbaseTable(hbaseTable);

if(df != null) { df = df.union(hbaseDf); } else { df = hbaseDf; }

}