pig tutorial - apache pig tutorial - Apache Pig - Filter Operator - pig latin - apache pig - pig hadoop

What is Filter Operator in Apache Pig ?

    • Filter operator is a simple and a powerful operation which is given in Apache Pig.
    • Filter operator filters only the desired data out of huge chunk of data and then it process business logic in parallel which is much faster when compared to filtering the data and running business logic on the full volume data.
    • The filter operator which is used in pig is used to remove unwanted records from the data file.
    • The filter operator is used to select the required tuples from a relation which is done based on the condition.
    • Filter operator allows us to remove unwanted records based on a condition.
  • FILTER instruction:
    • Generate a new relation by filtering data on a relation
    learn apache pig - apache pig tutorial - pig tutorial - apache pig examples - big data - apache pig script - apache pig program - apache pig download - apache pig example  -apache pig filter operation


      grunt> Relation2_name = FILTER Relation1_name BY (condition);



          • We have loaded the file into Pig with the relation name wikitechy_student_details which is given below:
          grunt>  wikitechy_student_details = LOAD 'hdfs://localhost:9000/pig_data/wikitechy_student_details.txt' USING PigStorage(',')
             as (id:int, firstname:chararray, lastname:chararray, age:int, phone:chararray, city:chararray);
          • Now we need to filter the data by using the Filter operator to get the details of the students who belong to the city Chennai.
          filter_data = FILTER wikitechy_student_details BY city == 'Chennai';


            grunt> Dump filter_data;



              Related Searches to Apache Pig - Filter Operator

              Adblocker detected! Please consider reading this notice.

              We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

              We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

              We need money to operate the site, and almost all of it comes from our online advertising.

              Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.