Support Questions

Find answers, ask questions, and share your expertise

grouping a relation in pig

avatar
Expert Contributor

Hi everyone, I'm trying to perform a grouping for a relation with the scheme below:

15913-pigscheme.png

I have created a the group all for whole relation as:

total_station_trips_all = GROUP october ALL;

Finally I'm trying to get the counting for the column s_station from the scheme october like

15914-pigscheme.png

Unfortunatelly I'm getting this error:

15915-pigscheme.png

Please guys give me a light about this error i will appreciate so much.

Thanks so much.

AU

1 ACCEPTED SOLUTION

avatar

You're not going to like it, but it is as simply as upper-casing "count" to be "COUNT". 😉

This brings up the larger issue around case-sensitivity in Pig. Generally, speaking case only really matters on alias names and things that end up being Java class names. Functions fall into that bucket, so just upper-case it and it'll work.

Additionally, you could simplify the code a bit to just do COUNT(october) instead of COUNT(october.s_station).

Good luck and happy Hadooping!

View solution in original post

3 REPLIES 3

avatar

You're not going to like it, but it is as simply as upper-casing "count" to be "COUNT". 😉

This brings up the larger issue around case-sensitivity in Pig. Generally, speaking case only really matters on alias names and things that end up being Java class names. Functions fall into that bucket, so just upper-case it and it'll work.

Additionally, you could simplify the code a bit to just do COUNT(october) instead of COUNT(october.s_station).

Good luck and happy Hadooping!

avatar
Expert Contributor

thanks , tried and working. I have just to be more careful on my typing. I appriciate.

avatar

Excellent. Truthfully, the case sensitivity is a bit weird in Pig -- kind of like the rules of the English language. Hehe!