Sort related bag
Asked Answered
T

1

5

I have a Pig script which generated a relation

A: {x: chararray,B: {(y: chararray,z: int)}}

I want to sort A based on B.y, however the following piece gives me error:

Syntax error, unexpected symbol at or near z

output = foreach A{
    sorted = order B by z DSC;
    generate x,sorted;
}
Trioecious answered 28/2, 2013 at 19:39 Comment(0)
S
8

Use DESC instead of DSC.

e.g.

output = foreach A{
    sorted = order B by z DESC;
    generate x,sorted;
}
Shackle answered 28/2, 2013 at 23:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.