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 |
What is pig statistics?
You have a file employee.txt in the hdfs directory with 100 records. You want to see only the first 10 records from the employee.txt file. How will you do this?
In which scenario Pig is better fit than MapReduce?
What are the 2 modes used to run pig scripts?
What are Pig Execution modes?
What are different String functions available in PIG?
What are the relational operators available related to Grouping and joining in Pig language?
What are the scalar data types in Pig?
What are the differences between PIG and HIVE?
What is illustrate used for in apache pig?
Mention the common features in Pig and Hive?
How to write 'foreach' statement for map datatype in pig scripts?
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)