Skip to main content
mhdeshmukh22
Gold ⭐️
March 13, 2016

Order by Operator in Pig

  • October 5, 2026 at 9:39 AM
  • 1 reply
  • 3662 views
  • Translate All

While using Order By operator in Pig Latin,If we have not mentioned ASC or DESC , by default it sorts by ASC order.

ex- grunt >OrderedData = order studentDetails by age;

This will sort by default in ASC order.

Otherwise We can mention here as below:

OrderedData = order studentDetails by age DESC;

OrderedData = order studentDetails by age ASC;

1 reply

TimothySpann
Platinum ⭐️⭐️⭐️
Platinum ⭐️⭐️⭐️
June 17, 2016

Yes ascending is usually a default in most languages.

https://pig.apache.org/docs/r0.14.0/basic.html#order-by

Usage

Note: ORDER BY is NOT stable; if multiple records have the same ORDER BY key, the order in which these records are returned is not defined and is not guarantted to be the same from one run to the next.

Translate