http://pig.apache.org/docs/r0.12.0/basic.html#order-by says
        "Pig currently supports ordering on fields with simple types or by 
tuple designator (*). You cannot order on fields with complex types or by 
expressions."

I think "you cannot order ... by expressions" means the behavior you see is 
expected.

William F Dowling
Senior Technologist
Thomson Reuters


-----Original Message-----
From: Ruslan Al-Fakikh [mailto:[email protected]] 
Sent: Tuesday, October 29, 2013 2:35 PM
To: [email protected]
Subject: ORDER BY a map value fails with a syntax error - pig bug?

Hi guys,

The following script:

A = LOAD 'input' AS (M:map []);
sorted = ORDER A BY M#'key1';
dump sorted;

gives:
2013-10-29 14:31:03,611 [main] ERROR org.apache.pig.tools.grunt.Grunt -
ERROR 1200: <file script1.pig, line 2, column 20>  Syntax error, unexpected
symbol at or near 'M'

While this one:
 LOAD 'input' AS (M:map []);
named = foreach A generate *, M#'key1' as myfield;
sorted = ORDER named BY myfield;
dump sorted;

is OK

Is it a bug in Pig?

Best Regards,
Ruslan Al-Fakikh

Reply via email to