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 |
Why should we use ‘orderby’ keyword in pig scripts?
How do you run the pig scripts in local mode?
What are the commonalities between pig and hive?
What are the different modes available in Pig?
Explain about the execution plans of a pig script?<Br> or<br> differentiate between the logical and physical plan of an apache pig script?
What is the difference between store and dumps commands?
What are the drawbacks of Pig?
What is a bag in Pig Latin?
Bag in pig ?
What are all stats classes in the org.apache.pig.tools.pigstats package?
Differentiate between piglatin and hiveql?
What is a tuple in pig?
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)