在Pig数据上应用过滤器时,不会存储数据

时间:2016-02-24 09:14:08

标签: apache-pig

我在本地模式下运行。

pig -x local

这是我的temp.txt

1925  44  999
1980  86  39
1928  60  42
1956  -10 54
1970  -5  55
1933  55  49
1977  44  59
1990  100 94 
1999  999 72
1989  77  81
1980  88  79
1990  98  77



Records1 = LOAD 'temp.txt' AS (year:chararray, temp:int, aqi:int);

我可以将数据加载到记录中,但是当我进行过滤时我能够读取但是没有发生存储...

以下是过滤器的命令:

Filtered = FILTER Records BY temp != 999 AND aqi !=999;

命令查看Filtered的内容:

dump Filtered;

以上是上述命令的结果..

Input(s):
Successfully read 12 records from: "file:///home/user/temp.txt"
Output(s):
Successfully stored 0 records in: "file:/tmp/temp-1913434963/tmp115707393"

Counters:
Total records written : 0
Total bytes written : 0
Spillable Memory Manager spill count : 0
Total bags proactively spilled: 0
Total records proactively spilled: 0

数据没有存储..请你帮帮我..

2 个答案:

答案 0 :(得分:0)

尝试此代码:

a = load '<path>/temp.txt' using PigStorage(' ') as (x,y,z);

b = filter a by y!=999 and z!=999;

dump b;

这将正常工作。

答案 1 :(得分:0)

<强>输入

Input

脚本

A = LOAD 'test9.txt' USING PigStorage(' ') AS (year:int,a:int,b:int);
B = FILTER A BY (a!=999 and b!=999);
DUMP B;

<强>输出

Output