Apache Pig Filter operator - Apache Pig

Why Apache Pig Filter operator option is used?

The FILTER operator is used to select the required tuples from a relation based on a condition.

Syntax

Here’s the syntax of the FILTER operator.

Example

Let’s see that we have a file named student_details.txt in the HDFS directory /pig_data/ as discussed below:
student_details.txt
And we have loaded this file into Pig with the relation name student_details as shown below.
Now apply the Filter operator to get the student details from the city Chennai.

Verification

Let’s verify the relation filter_data using the DUMP operator as shown below.

Output

It will deliver the below mentioned final output by displaying the contents of the relation filter_data.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Apache Pig Topics