Putting the pig list back on the thread.

You need to read both tables and join

tableA = load 'hbase://A' using HBaseStorage('cf:fname','-loadKey true
-gt 1 -lt 3') as (id:chararray, table_b_id:chararray);

tableB = load 'hbase://B' using HBaseStorage('cf:fname','-loadKey true') as
(id:chararray);

joined = JOIN tabledA BY table_b_id, tableB BY id;


See http://pig.apache.org/docs/r0.9.2/basic.html#join-inner

On Thu, Feb 16, 2012 at 11:38 PM, chethan <[email protected]> wrote:

> We have two tables, table A and table B in the HBase.
> the rowkey of the table B is stored in table A ( using a column
> information we should generate rowkey of table B ) .
> so there is user defined function which will give the rowkey of the table
> B, so using that rowkey result we have to issue the command to fetch the
> record from table B.
>
>
> On Fri, Feb 17, 2012 at 12:51 PM, Bill Graham <[email protected]>wrote:
>
>> There is no way that I'm aware of to pass a dynamic scalar from a
>> relationship into the constructor of a LoadFunc.
>>
>> Can you explain your use case in more detail? Why do you need to query
>> HBase for a range of keys, just to do the same thing again? In your example
>> result is a relationship, so what are trying to achieve by querying HBase
>> where the key is greater than a relationship of tuples?
>>
>> I would expect what you're attempting could be done with a self-join
>> followed by a filter, but I'm still a bit hazy on what you're going for.
>>
>>
>>
>> On Thu, Feb 16, 2012 at 11:01 PM, chethan <[email protected]> wrote:
>>
>>> Hi Bill,
>>>
>>> So is there any way where we can achieve this, giving
>>> the variable result's value for comparison in runtime. Because that is the
>>> requirement to be achieved.
>>>
>>> On Thu, Feb 16, 2012 at 10:35 PM, Bill Graham <[email protected]>wrote:
>>>
>>>>  The -lt -gt syntax is correct for result - it takes scalar values that
>>>> define the range of the keys you want.
>>>>
>>>> user_links is using -gt incorrectly. It doesn't take a Pig relationship
>>>> as
>>>> a parameter so it's looking for keys that are lexicographically greater
>>>> than the string 'result'.
>>>>
>>>> On Thu, Feb 16, 2012 at 2:37 AM, chethan <[email protected]> wrote:
>>>>
>>>> > Hi,
>>>> >
>>>> > I want to fetch the records from the HBase tables using pig language.
>>>> >
>>>> > Details of HBase table:
>>>> >
>>>> > HBASE TABLE NAME : sample_names
>>>> > COLUMN FAMILY NAME : cf
>>>> > COLUMN NAME : fname
>>>> > ROWKEY VALUES : 1,2,3,4
>>>> >
>>>> > I am using following commands :
>>>> >
>>>> > result = load 'hbase://sample_names' using
>>>> > org.apache.pig.backend.hadoop.hbase.HBaseStorage('cf:fname','-loadKey
>>>> true
>>>> > -gt 1 -lt 3') as (id:chararray);
>>>> > user_links = load 'hbase://sample_names' using
>>>> > org.apache.pig.backend.hadoop.hbase.HBaseStorage('cf:fname','-loadKey
>>>> true
>>>> > -gt result') as (name:chararray);
>>>> >
>>>> > dump result ( is giving value '2' )
>>>> > dump user_links ( returning nothing )
>>>> >
>>>> > Problem:
>>>> >
>>>> > Though I am having value '2' in the result,
>>>> > I am getting nothing in the return, it is not taking result's value
>>>> '2' for
>>>> > comparison at all.
>>>> >
>>>> > Is my approach wrong, i want the value of the result to go for
>>>> comparison.
>>>> >
>>>> > Thanks & Regards
>>>> > Chethan Prakash
>>>> >
>>>>
>>>>
>>>>
>>>> --
>>>> *Note that I'm no longer using my Yahoo! email address. Please email me
>>>> at
>>>> [email protected] going forward.*
>>>>
>>>
>>>
>>
>>
>> --
>> *Note that I'm no longer using my Yahoo! email address. Please email me
>> at [email protected] going forward.*
>>
>
>


-- 
*Note that I'm no longer using my Yahoo! email address. Please email me at
[email protected] going forward.*

Reply via email to