sorry there was a typo in the script.
last line of the script is as follows:

temp = filter temp by org.apache.pig.piggybank.evaluation.datetime.DiffDate(
        A.$0,elmp)/30 <= 9;
Thanks,
Ips

On Tue, Oct 11, 2011 at 1:05 AM, ipshita chatterji <[email protected]> wrote:
> Dear All,
> I am consistently getting following error on execution of my pig script:
>
> " [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 2997: Unable
> to recreate exception from backed error: java.lang.ClassCastException:
> org.apache.pig.data.DataByteArray cannot be cast to java.lang.String"
>
> I have checked my input files and they seem to have inputs in the
> right format. My pig script is as follows:
> At this point I am unable to figure out whats going wrong at my end.
> Any helpful info on the problem will be appreciated.
>
> Thanks and regards,
> Ips
>
> register piggybank.jar;
> register joda-time-1.6.jar ;
>
> A= LOAD 'date.csv' USING PigStorage(',') AS (a1:chararray);
>
>
>
> o1 =  load 'obsv.csv'
>        as (obs_id:chararray, en_id:chararray, sub_en_id:chararray,
> o_by:chararray, v_by:chararray, rmk:chararray);
>
> oc1 = load 'obsv_concpt.csv' as (obs_id:chararray,
> concept_id:chararray, concept_val:chararray);
>
> l1 = load 'locations.csv'
>        as (lid:chararray, lng:chararray, lt:chararray, field1:chararray,
> field2:chararray, field3:chararray, field4:chararray,
>                field5:chararray, field6:chararray, field7:chararray,
> field8:chararray, field9:chararray);
>
> e1 = load 'encntr.csv'
>        as (en_id:chararray, pid:chararray, lid:chararray, edttime:chararray);
>
> p1 = load 'persons.csv'
>        as (pid:chararray, gen:chararray, giv_nm:chararray, middle:chararray,
> fm_nm:chararray, bdt:chararray,
>                bdt_est:chararray, bt_pl:chararray, mnm:chararray, 
> sps_nm:chararray,
>                dth_dt:chararray, dth_dt_estm:chararray, lid:chararray, 
> mrr_dt:chararray,
>                mrr_dt_estm:chararray, entry_date:chararray, 
> mrr_dt_sts:chararray,
> contact_number:chararray,
>                fth_name:chararray);
>
> pid = load 'p_pat_id_type.csv'
>        as (p_pat_id_type_id:chararray, pid:chararray, p_pat_id:chararray);
>
> f1 = load 'families.csv'
>        as (fam_id:chararray, fam_hd:chararray, identifier:chararray);
>
> oc1 = filter oc1 by concept_id eq '55';
>
> temp = join  oc1 by obs_id, o1 by obs_id;
>
> temp = join temp by o1::en_id, e1 by en_id;
>
> temp = join p1 by pid, temp by e1::pid;
>
> temp = join l1 by lid, temp by p1::lid;
>
> temp = join f1 by fam_hd, temp by p1::pid;
>
> temp = join pid by pid, temp by p1::pid;
>
>
> temp = group temp by p1::pid;
>
> temp = foreach temp generate
> flatten(temp),org.apache.pig.builtin.MAX(temp.oc1::concept_val) as
> elmp;
>
> temp  = foreach temp generate
>            pid::p_pat_id_type_id as p_pat_id_type_id,
>            p1::giv_nm as giv_nm,
>                p1::mnm as mnm,
>                pid::p_pat_id as p_pat_id,
>                l1::field3 as field3,
>                        p1::bdt as bdt,
>                        elmp as elmp;
>
> temp  = foreach temp generate
>            p_pat_id_type_id as p_pat_id_type_id,
>            giv_nm as giv_nm,
>                mnm as mnm,
>                p_pat_id as p_pat_id,
>                field3 as field3,
>                        bdt as bdt,
>                        elmp as elmp,
>            org.apache.pig.piggybank.evaluation.string.SUBSTRING(bdt,0,10)
> as bdt;
>
> temp  = foreach temp generate
>            p_pat_id_type_id as p_pat_id_type_id,
>            giv_nm as giv_nm,
>                mnm as mnm,
>                p_pat_id as p_pat_id,
>                field3 as field3,
>                        bdt as bdt,
>                        
> org.apache.pig.piggybank.evaluation.string.REPLACE(elmp,'-','') as elmp,
>            org.apache.pig.piggybank.evaluation.string.REPLACE(bdt,'-','')
> as bdt;
>
> temp  = foreach temp generate
>        giv_nm as giv_nm,
>        mnm as mnm,
>        p_pat_id as p_pat_id,
>        field3 as field3,
>        org.apache.pig.piggybank.evaluation.datetime.DiffDate(
>        A.$0, bdt) / 365  as Age,
>        elmp as elmp;
>
> temp = filter temp by org.apache.pig.piggybank.evaluation.datetime.DiffDate(
>        A.$0,LMP)/30 <= 9;
>
> On executing this last step I get  the exception........................
>

Reply via email to