hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikael Sitruk <mikael.sit...@gmail.com>
Subject Re:
Date Tue, 23 Apr 2013 07:19:16 GMT
Suneel hi

In addition to Mohammad answer -
In order for someone to be able to translate to pig latin you should
also provide indication how the data is stored, are you using hbase for
storing the data or directly on hdfs? according to this you can transform
your field mappings. You need to explain the schema

you should probably try the pig tutorial to get better understanding of how
to perform queries, MAX, COUNT, FOREACH, GROUP, FILTER, JOIN (inner &
outer) are operator supported by pig. Sub select should be break in
different "select" (a.k.a. relation)
For the case statements I presume you will have to implement some udf.


Mikael.S




On Mon, Apr 22, 2013 at 11:31 PM, Mohammad Tariq <dontariq@gmail.com> wrote:

> Hello Suneel,
>
>        Not the answer to your question, but definitely gonna help you in
> getting the answer.
>
> This list is specific to Hadoop users. It would be better if you ask this
> question on the Pig mailing list.
>
> Providing a subject line is always a good habit.
>
> It's always better to show something which you have tried. People on the
> mailing list might not be free enough to go through big complex queries or
> programs. But they could definitely try to help you in order to make it
> work or better.
>
> HTH
>
> Warm Regards,
> Tariq
> https://mtariq.jux.com/
> cloudfront.blogspot.com
>
>
> On Mon, Apr 22, 2013 at 2:46 PM, suneel hadoop <suneel.bigdata@gmail.com>wrote:
>
>> Can any one help me to change this SQL to pig Latin
>>
>>
>>
>> SELECT ('CSS'||DB.DISTRICT_CODE||DB.BILLING_ACCOUNT_NO) BAC_KEY,
>>
>> CASE WHEN T1.TAC_142 IS NULL THEN 'N' ELSE T1.TAC_142 END TAC_142 FROM
>>
>> (
>>
>>
>>
>> SELECT DISTRICT_CODE,BILLING_ACCOUNT_NO,
>>
>> MAX(CASE WHEN TAC_1 = 'Y' AND (TAC_2 = 'Y' OR TAC_3 = 'Y') THEN 'Y' ELSE
>> 'N' END) TAC_142 FROM
>>
>> (
>>
>> SELECT DI.DISTRICT_CODE,DI.BILLING_ACCOUNT_NO,DI.INST_SEQUENCE_NO,
>>
>> MAX(CASE WHEN TRIM(DIP.PRODUCT_CODE) = 'A14493' AND UPPER(DI.HAZARD) LIKE
>> '%999%EMERGENCY%LINE%' AND UPPER(DI.WARNING) LIKE '%USE%999%ALERT%METHOD%'
>> THEN 'Y' ELSE 'N' END) TAC_1,
>>
>> MAX(CASE WHEN TRIM(DIP.PRODUCT_TYPE) IN ('20','21') AND
>> TRIM(DIP.MAINTENANCE_CONTRACT) IN ('E','T') THEN 'Y' ELSE 'N' END) TAC_2,
>>
>> MAX(CASE WHEN TRIM(DIP.PRODUCT_CODE) IN ('A14498','A14428','A22640') THEN
>> 'Y' ELSE 'N' END) TAC_3
>>
>> FROM
>>
>> D_INSTALLATION DI,
>>
>> D_INSTALLATION_PRODUCT DIP
>>
>> WHERE
>>
>> DIP.INST_SEQUENCE_NO = DI.INST_SEQUENCE_NO AND
>>
>> DIP.BAC_WID = DI.BAC_WID
>>
>> GROUP BY DI.DISTRICT_CODE,DI.BILLING_ACCOUNT_NO,DI.INST_SEQUENCE_NO
>>
>> )
>>
>> GROUP BY DISTRICT_CODE,BILLING_ACCOUNT_NO)
>>
>> T1,
>>
>> D_BILLING_ACCOUNT DB
>>
>> WHERE
>>
>> DB.DISTRICT_CODE = T1.DISTRICT_CODE(+) AND
>>
>> DB.BILLING_ACCOUNT_NO = T1.BILLING_ACCOUNT_NO(+)
>>
>
>

Mime
View raw message