How can we see only top 15 records from the student.txt out of100 records in the HDFS directory?



How can we see only top 15 records from the student.txt out of100 records in the HDFS directory?..

Answer / Harpal Singh

To view only the top 15 records from a text file (student.txt) in the HDFS directory, you would first need to load the data into Pig, and then use the LIMIT operator to limit the number of rows returned. Here is an example:

A = LOAD 'hdfs://namenode/path/to/student.txt' AS (name:chararray, age:int, grade:float);
B = LIMIT A BY 15;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Apache Pig Interview Questions

Does Pig support multi-line commands?

1 Answers  


Can we say a COGROUP is a group of more than 1 data set?

1 Answers  


What is the MapReduce plan in pig architecture?

1 Answers  


Does Pig differ from MapReduce? If yes, how?

1 Answers  


How will you merge the contents of two or more relations and divide a single relation into two or more relations?

1 Answers  


What are the different Relational Operators available in pig language?

1 Answers  


Explain totuple function?

1 Answers  


Define the Use of Pig?

1 Answers  


What co-group does in Pig?

1 Answers  


What is Apache Pig?

1 Answers  


What are the differences between PIG and SQL?

1 Answers  


What are the primitive data types in Pig?

1 Answers  


Categories