You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Ruslan Al-Fakikh <me...@gmail.com> on 2013/10/29 19:35:05 UTC

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

Re: ORDER BY a map value fails with a syntax error - pig bug?

Posted by Ruslan Al-Fakikh <me...@gmail.com>.
Thanks, William!


On Tue, Oct 29, 2013 at 10:41 PM, <wi...@thomsonreuters.com>wrote:

> 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:metaruslan@gmail.com]
> Sent: Tuesday, October 29, 2013 2:35 PM
> To: user@pig.apache.org
> 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
>

RE: ORDER BY a map value fails with a syntax error - pig bug?

Posted by wi...@thomsonreuters.com.
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:metaruslan@gmail.com] 
Sent: Tuesday, October 29, 2013 2:35 PM
To: user@pig.apache.org
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