I have a relation r. How can I get the top 10 tuples from the relation r?



I have a relation r. How can I get the top 10 tuples from the relation r?..

Answer / Amit Anand

In Apache Pig, to get the top 10 tuples from a relation, you can use the TOP operator. Here's an example:nn`DEFINE myUDF MyUserDefinedFunction();ndata = LOAD 'input_data' AS (col1: chararray, col2: int, col3: float);ntop_data = FOREACH data GENERATE *;ntop_data = TOP top_data 10;nSTORE top_data INTO 'output_data';`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Apache Pig Interview Questions

How to fetch particular columns in pig?

1 Answers  


What is the use of binstorage?

1 Answers  


How to restrict the number of lines to be printed in pig ?

1 Answers  


What is a tuple?

3 Answers  


What is Pig Storage?

1 Answers  


What is illustrate used for in apache pig?

1 Answers  


Differentiate between GROUP and COGROUP operators?

1 Answers  


What is Apache Pig?

1 Answers  


What are the execution modes in the apache pig?

1 Answers  


What are the different types of UDF's in Java supported by Apache Pig?

1 Answers  


What are the components of Pig Execution Environment?

1 Answers  


Pig Features ?

1 Answers  


Categories