Hi,
I am new to Hadoop and Pig Latin Language. 
I am trying to convert the below Hive QL to Pig Latin. Any suggestions please.

INSERT OVERWRITE TABLE A
SELECT id, org_type, dept_type, cnt, cnt_distinct
FROM (SELECT id, 'S' org_type, dept_type, COUNT(1) cnt, COUNT(DISTINCT dept_id) 
cnt_distinct
         FROM B
         WHERE visible_flag = 1
         GROUP BY id, dept_type

Questions:
1. Is there an option to overwrite the table ? OR what does Pig Latin offer ?
2. You can see in the inner Query "'S' org_type" I am creating a new column and 
inserting 'S' as the value to this. what does Pig Latin offer ?
3. Related to Q2, "COUNT(1) cnt" for every id I am incrementing the count based 
on how many dept_type and id has and generating a new column and inserting the 
count in there. How can I do this in pig ?

Thanks for you help. 

Regards
MD

                                          
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

Reply via email to