try this :
A=load '/HADOOP/Yogesh/demo.txt' using PigStorage (' ') as
(name:chararray, roll:int)

Regards,
    Mohammad Tariq


On Wed, Jul 25, 2012 at 11:47 PM, pablomar
<pablo.daniel.marti...@gmail.com> wrote:
> are the commas in your file in the write places ?
> your DUMP A shows
> (Yogesh 12,)
> (Aashi 13,)
> (mohit 14,)
>
> comma after the number. It makes me believe that it is taking both fields
> as name, so when you do the foreach, it keeps the whole thing
>
> I mean, is your file (wrong)
> Yogesh 12,
> Aashi 13,
> mohit 14,
>
> or (good, for this case)
> Yogesh, 12
> Aashi, 13
> mohit, 14
>
>
> On Wed, Jul 25, 2012 at 2:06 PM, <yogesh.kuma...@wipro.com> wrote:
>
>> Hi all,
>>
>> I loaded a file to pig by command from HDFS.
>>
>> A=load '/HADOOP/Yogesh/demo.txt'
>> as (name:chararray, roll:int);
>>
>> its get loaded and when i do
>>
>> dump A:
>>
>> it shows
>>
>> (Yogesh 12,)
>> (Aashi 13,)
>> (mohit 14,)
>>
>> Now i run another query
>>
>> B= foreach A generate name;
>>
>> to get result only names from A.
>>
>> but dump B; hows the same result as of    dump A; i.e
>>
>> (Yogesh 12,)
>> (Aashi 13,)
>> (mohit 14,)
>>
>>
>> Please help and suggest.
>>
>> Thanks & Regards
>> Yogesh Kumar
>>
>> Please do not print this email unless it is absolutely necessary.
>>
>> The information contained in this electronic message and any attachments
>> to this message are intended for the exclusive use of the addressee(s) and
>> may contain proprietary, confidential or privileged information. If you are
>> not the intended recipient, you should not disseminate, distribute or copy
>> this e-mail. Please notify the sender immediately and destroy all copies of
>> this message and any attachments.
>>
>> WARNING: Computer viruses can be transmitted via email. The recipient
>> should check this email and any attachments for the presence of viruses.
>> The company accepts no liability for any damage caused by any virus
>> transmitted by this email.
>>
>> www.wipro.com
>>

Reply via email to