Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Invalid scalar projection in pig

Invalid scalar projection in pig

Contributor

grunt> uniqcnt_1 = foreach uniq_sym_1 generate COUNT(uniq_sym_1.symbol);

2016-11-25 00:35:49,902 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: Pig script failed to parse: <line 10, column 46> Invalid scalar projection: uniq_sym_1 Details at logfile: /home/naresh/Work1/hadoop-1.2.1/bin/pig_1480051207097.log 

grunt> describe uniq_sym_1;

uniq_sym_1: {{(symbol: bytearray)}}

3 REPLIES 3

Re: Invalid scalar projection in pig

Guru

This is likely an issue with how you are grouping the data before count.

Could you update your question with full script up to the count line? Also, posting two lines of data will be helpful.

Re: Invalid scalar projection in pig

Contributor

Hi @Greg Keys

Please find more information as mentioned below

daily = load '/pigdata/NYSE_daily' as (exchange, symbol); -- not interested in other fields
grunt> grpd = group daily by exchange;
grunt> sym_1 = foreach grpd generate daily.symbol;
grunt>uniq_sym_1 = distinct sym_1;
grunt> uniqcnt_1 = foreach uniq_sym_1 generate COUNT(uniq_sym_1.symbol);--error

2017-01-18 13:12:06,097 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: Pig script failed to parse: 
<line 5, column 46> Invalid scalar projection: uniq_sym_1
Details at logfile: /home/naresh/Work1/hadoop-1.2.1/bin/pig_1484761467201.log

grunt> describe uniq_sym_1;
uniq_sym_1: {{(symbol: bytearray)}}
grunt> 



 
Highlighted

Re: Invalid scalar projection in pig

Contributor

Hi experts,

Any input on my clarification

Don't have an account?
Coming from Hortonworks? Activate your account here