Member since
01-04-2017
15
Posts
0
Kudos Received
1
Solution
My Accepted Solutions
Title | Views | Posted |
---|---|---|
815 | 02-26-2017 06:19 AM |
04-06-2017
12:31 PM
Hi Martin,
thanks so much,
I also tried with:
a = foreach b generate (int)$0 as f1.;
and this piece of code function..
Any idea about the difference between:
a = foreach b generate (int)$0 as f1;
and
a = foreach b generate (int)$0 as f1:int;
?
thanks.
Regard,
Mauro
bye.
... View more
04-04-2017
04:23 AM
Hi,
I seems it is not able to cast in the right way.
The following three pieces of code work properly:
a = load '/user/horton/salary' using PigStorage('\t') as ( year:int, name:chararray, salary:int );
store a into 'salary' using org.apache.hive.hcatalog.pig.HCatStorer();
a = load '/user/horton/salary' as ( year:int, name:chararray, salary:int );
store a into 'salary' using org.apache.hive.hcatalog.pig.HCatStorer();
a = load '/user/horton/salary';
b = FOREACH a GENERATE (int)$0 as year:int, (chararray)$1 as name:chararray, (int)$2 as salary:int;
store b into 'salary' using org.apache.hive.hcatalog.pig.HCatStorer();
Thanks
... View more
04-03-2017
04:46 PM
Hi,
It's quite late... I will try and I will update the thread soon. Thanks for the moment.
Bye
... View more
04-03-2017
04:30 PM
Hi,
I'm working on EC2 hortonworks machine for HDPCD certification exam.
... View more
04-03-2017
04:00 PM
Hi I'm trying to load data from pig to hive using hcatalog. It's just for training... I have the following data: year name salary
2015 Marc 100
2016 Marc 200
2017 Marc 300
2015 Lucy 100
2016 Lucy 200
2017 Lucy 300
2015 John 100
2016 John 200
2017 John 300 i created a table on Hive: create table salary ( year int, name string, salary int ); and the following script in pig: a = load '/user/horton/salary';
b = FOREACH a GENERATE $0 as year:int, $1 as name:chararray, $2 as salary:int;
store b into 'salary' using org.apache.hive.hcatalog.pig.HCatStorer(); but, calling pig -useHCatalog, I obtain an error: prg.apache.pig.data.DataByteArray cannot be cast to java.lang.Integer What's wrong? Any suggestion will be appreciated.
... View more
- Tags:
- cast
- Data Processing
- Pig
- Upgrade to HDP 2.5.3 : ConcurrentModificationException When Executing Insert Overwrite : Hive
Labels:
- Labels:
-
Apache Pig
04-03-2017
01:07 PM
Hi all, I have a text file that look like (the is no header...): Year\tName\tSalary 2015 Marc 100
2016 Marc 200
2017 Marc 300
2015 Lucy 100
2016 Lucy 200
2017 Lucy 300
2015 John 100
2016 John 200
2017 John 300 and I wanto to calculate avg salary for each employee. By executing the following code: a = load '/user/horton/salary' as ( year:int, name:chararray, salary:int );
b = group a by name;
d = FOREACH b GENERATE group as name, AVG( a.salary ) as avgsalary;
describe d;
d { name: chararray, avgsalary: double ) } }
dump d; I obtained the result as aspected: (Marc, 200 ) (Lucy, 200 ) (John, 200 ) But, when I tried the following code: a = load '/user/horton/salary';
b = FOREACH a GENERATE $0 as year:int, $1 as name:chararray, $2 as salary:int;
b { year: int, name: chararray, salary: int }
c = group b by name;
c { group: chararray, b { ( year: int, name: chararray, salary: int ) } }
d = FOREACH c GENERATE group as name, AVG( b.salary ) as avgsalary;
describe d;
d { name: chararray, avgsalary: double ) } }
dump d; I have got an error: Error 0 Exception while executing (Name: c: Local Rearrange[touple]{chararry}(false) - scope 33 Operator key: scope-33) org.apache.pig.beckend.executionengine.ExecException: ERROR while computing average Initial Why? Can anyone help me? In general what is the approach whenever I have a file with a lot of fields and I cannot explicitly declare all the fields name in the LOAD phase? Thanks. Mauro
... View more
Labels:
- Labels:
-
Apache Pig
02-26-2017
06:19 AM
Hi,
sorry, it just took some minutes...
I definitively solve my problem.
Thank you very much for your support.
Bye
Mauro
... View more
02-26-2017
06:16 AM
Hi,
I repeted the procedure a couple of time and now I have some services started, unfortunately, Hive and Nagios don't start...
Any other idea?
thanks a lot,
Mauro
... View more
02-26-2017
06:11 AM
Hi,
AMI id =
Hortonworks HDPCDeveloper_2.2 PracticeExam_v7 (ami-0e796562)
and
Availability zone =
eu-central-1b
I tryied with th suggested procedure, but I did not resolve the problem.
Regards,
Mauro
... View more
02-25-2017
09:27 AM
Hi I'm trying to get certifyied (HDPCD) and I'm using an EC2 host. I had no problem for sever week, but, this morning, all services are down I tryied with ./start-all-service.sh without success... I also tryied to reboot the machine, no success at all... any idea on how to run all services? Thank you very much.. Mauro
... View more