0
votes

I am very new to hbase. We have a requirement to fetch certain data of a table. Below is the sample dataset. I am stuck in creating filter which seems bit complex to me. In query I will be getting value1, which I need to compare with ID1 CQ's value, another value let say value2 which I need to compare with ID2 CQ's value. After that there are multiple entries with column jj_, here I need to first get the latest time of all columns that starts with jj_ and then compare value3 with the value of latest jj_ CQ's value. In sql I can create query like select * .. where ID1='' and ID2='' and ID3=''. How I can achieve the same in Hbase. Any help will be highly appriciated.

ROW                                  COLUMN+CELL                                                                                              
 1                                   column=d:ID1, timestamp=1496273604085, value=5678                                                      
 1                                   column=d:ID2, timestamp=1496273604085, value=Jan                                                      
 1                                   column=d:data, timestamp=1496273604085, value=TestData1                               
 1                                   column=d:jj_01/01/2017 01:37:56 AM, timestamp=1496273604085, value=11345601/01/2017 01:37:56 AM          
 2                                   column=d:ID1, timestamp=1496273604105, value=5678                                                      
 2                                   column=d:ID2, timestamp=1496273604105, value=Jan                                                      
 2                                   column=d:data, timestamp=1496273604105, value=TestData2                              
 2                                   column=d:jj_01/02/2017 10:37:56 AM, timestamp=1496273604105, value=11345601/02/2017 10:37:56 AM          
 2                                   column=d:jj_01/02/2017 11:37:56 PM, timestamp=1496273604105, value=11345601/02/2017 11:37:56 PM          
 3                                   column=d:ID1, timestamp=1496273604112, value=5678                                                      
 3                                   column=d:ID2, timestamp=1496273604112, value=Jan,Feb                                                  
 3                                   column=d:data, timestamp=1496273604112, value=TestData3                            
 3                                   column=d:jj_02/01/2017 11:37:56 AM, timestamp=1496273604112, value=11345602/01/2017 11:37:56 AM          
 4                                   column=d:ID1, timestamp=1496273604124, value=5678,1234                                                 
 4                                   column=d:ID2, timestamp=1496273604124, value=Jan,Dec                                                  
 4                                   column=d:data, timestamp=1496273604124, value=TestData4                                    
 4                                   column=d:jj_02/02/2017 09:37:56 PM, timestamp=1496273604124, value=11345602/02/2017 09:37:56 PM          
 4                                   column=d:jj_02/02/2017 11:37:56 AM, timestamp=1496273604124, value=11345602/02/2017 11:37:56 AM          
 5                                   column=d:ID1, timestamp=1496273604133, value=5678,1234                                                 
 5                                   column=d:ID2, timestamp=1496273604133, value=Jan                                                      
 5                                   column=d:data, timestamp=1496273604133, value=TestData5                         
 5                                   column=d:jj_01/05/2017 11:37:56 AM, timestamp=1496273604133, value=11345601/05/2017 11:37:56 AM          
 5                                   column=d:jj_01/06/2017 09:37:56 PM, timestamp=1496273604133, value=11345601/06/2017 09:37:56 PM          
 6                                   column=d:ID1, timestamp=1496273604138, value=5678                                                      
 6                                   column=d:ID2, timestamp=1496273604138, value=Dec                                                      
 6                                   column=d:data, timestamp=1496273604138, value=TestData6                          
 6                                   column=d:jj_02/02/2017 09:37:56 AM, timestamp=1496273604138, value=11345602/02/2017 09:37:56 AM          
 7                                   column=d:ID1, timestamp=1496273604148, value=5678                                                      
 7                                   column=d:ID2, timestamp=1496273604148, value=Jan                                                      
 7                                   column=d:data, timestamp=1496273604148, value=TestData7                                
 7                                   column=d:jj_02/03/2017 09:37:56 AM, timestamp=1496273604148, value=11345602/03/2017 09:37:56 AM 
1

1 Answers

0
votes

You can use a FilterList, for example

scan.setFilter(
  new FilterList(
    FilterList.Operator.MUST_PASS_ALL, 
    new myCustomFilterA(), 
    new myCustomFilterB(),
    ...
  )
);