apache-pig - Apache Pig ORDER 比 LIMIT 返回 null
问题描述
我有猪的问题。我试图通过将项目组合在一起并计算数量来计算项目出现在某处的次数。然后我订购它们并将数量限制在前十名。当我转储有序集时,它工作正常,但是当我尝试转储有限集时,它每次都失败。我四处寻找这个问题并没有发现任何东西。我能得到一些帮助吗?这是下面的代码。
lines = LOAD '/share/smallspoilers' USING PigStorage(':') AS (location:chararray,lNum:chararray,item:chararray,iNum:chararray);
newLines = FOREACH lines GENERATE(item),REPLACE(location, '"', '') AS location;
newerLines = FOREACH newLines GENERATE(item),REPLACE(location, ' ', '') AS location;
newestLines = FOREACH newerLines GENERATE(location),REPLACE(item, '"', '') AS item;
finalLines = FOREACH newestLines GENERATE(location),REPLACE(item, ' ', '') AS item;
filteredLines = FILTER finalLines BY (item matches 'Lamp');
grouped = GROUP filteredLines BY location;
counted = FOREACH grouped GENERATE group, COUNT(filteredLines) AS total;
ordered = ORDER counted BY total DESC;
prac = LIMIT ordered 10;
dump prac;
解决方案
推荐阅读
- java - How to enable Spring Bean Validation before persisting but ignore for HTTP request
- jquery - Django using ajax
- python - Pyinstaller 在没有错误消息的情况下卡住
- python - Compress data into smallest amount of text?
- reactjs - Trying to re-use a component and make a property conditional
- reactjs - React render props.children 在运行子事件时失败(子事件是组件)
- karabiner - How do make karabiner type Ä?
- android - Gradle task assembleDebug failed with exit code 1
- nlp - when calculating the cooccurance of two words, do we sepate the sentences or linking all sentences?
- sql - PostgreSQL last_value 忽略空值