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 |
How to fetch particular columns in pig?
What is the use of binstorage?
How to restrict the number of lines to be printed in pig ?
What is a tuple?
What is Pig Storage?
What is illustrate used for in apache pig?
Differentiate between GROUP and COGROUP operators?
What is Apache Pig?
What are the execution modes in the apache pig?
What are the different types of UDF's in Java supported by Apache Pig?
What are the components of Pig Execution Environment?
Pig Features ?
Apache Hadoop (394)
MapReduce (354)
Apache Hive (345)
Apache Pig (225)
Apache Spark (991)
Apache HBase (164)
Apache Flume (95)
Apache Impala (72)
Apache Cassandra (392)
Apache Mahout (35)
Apache Sqoop (82)
Apache ZooKeeper (65)
Apache Ambari (93)
Apache HCatalog (34)
Apache HDFS Hadoop Distributed File System (214)
Apache Kafka (189)
Apache Avro (26)
Apache Presto (15)
Apache Tajo (26)
Hadoop General (407)