Javatpoint Logo
Javatpoint Logo

Apache Pig ORDER BY Operator

The Apache Pig ORDER BY operator sorts a relation based on one or more fields. It maintains the order of tuples.

Example of ORDER BY Operator

In this example, we return only two tuples from all the tuples in the relation.

Steps to execute ORDER BY Operator

  • Create a text file in your local machine and insert the list of tuples.
Apache Pig ORDER BY Operator
  • Check the tuples inserted in the text files.
Apache Pig ORDER BY Operator
  • Upload the text files on HDFS in the specific directory.
  • Open the pig MapReduce run mode.
  • Load the file that contains the data.
  • Now, execute and verify the data.
Apache Pig ORDER BY Operator
  • Let's return the first two tuples.
Apache Pig ORDER BY Operator

Here, we got the desired output.

Next TopicSPLIT Operator





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA