如何从 HDFS 中 student.txt 的 100 条记录里只查看前 15 条?
How can we see only top 15 records from student.txt out of 100 records in the HDFS directory?
题目类型: 技术面试题
这是一道技术面试题,常见于澳洲IT公司面试中。
难度: easy
分类: Pig 常用技巧, 数据抽样与限制
标签: LIMIT, HDFS, relation, top records
参考答案摘要
核心答案 在 Pig 中可以先把文件加载为一个 relation(例如命名为 student ),然后使用 LIMIT 操作符获取前 15 条记录: student = LOAD 'student.txt' USING PigStorage('\t'); result = LIMIT student 15; DUMP result;
本题提供 STAR 原则详细解答和技术解析,登录匠人学院学习中心即可查看完整答案。