猪:我的过滤器没有给出结果

时间:2018-04-09 07:03:58

标签: hadoop filter apache-pig

你好,我是hadoop环境的新人。 我已经要求在csv上提供数据。

>LoadHomicide = LOAD '/user/admin/Crimes_samples.csv' USING PigStorage('\t') >AS >(Date:chararray,Block:chararray,PrimaryType:chararray,
>Description:chararray,
>LocationDescription:chararray,Arrest:chararray,Domestic:chararray,District:c>hararray,Year:chararray);

>uniq_arrest = FILTER LoadHomicide BY ($5 matches'%FALSE%');
>dump uniq_arrest;

我没有任何错误,但脚本的日志在这里给出了答案成功csv。

ID","案例编号","日期","阻止"," IUCR","主要输入","说明","位置说明","逮捕","国内","击败" ,"区","沃德","社区"," FBI代码"," X坐标",& #34; Y坐标","年","更新时间","纬度","经度","位置和#34;

  

0442761," HZ181379",3/9/16 11:55 PM," 023XX N HAMLIN   AVE"" 0560"" ASSAULT"" SIMPLE""公寓""假&#34 ;, "假"" 2525"" 025" 35" 22"" 08A",1150660,1915214 ,2016,03 / 16 / 2016,41.92,-87.72,"(41.923245915,   -87.721845939)" 10442848," HZ181470",3/9/16 11:55 PM," 0000X W JACKSON BLVD"," 1310"," CRIMINAL DAMAGE&#34 ;," TO PROPERTY"," CTA GARAGE / OTHER   PROPERTY""假""假"" 0113"" 001&#34,2," 32&#34 ;," 14",1176304,1898987,2016,03 / 16 / 2016,41.88,-87.63,"(41.878177799,   -87.628111493)" 10442789," HZ181391",3/9/16 11:55 PM," 052XX W HURON ST"," 1150"," DECEPTIVE EXACTICE&#34 ;,"信用卡   欺诈"" ALLEY""假""假"" 1524"" 015&#34 ;, 28," 25"" 11",1141433,1904126,2016,03 / 16 / 2016,41.89,-87.76,"(41.892994741,   -87.756023813)" 10447046," HZ185157",3/9/16 11:50 PM," 055XX N LINCOLN AVE"," 0460"," BATTERY" " SIMPLE"" HOTEL

1 个答案:

答案 0 :(得分:0)

#include <stdio.h> /* using printf, gets, BUFSIZ */ int main(int argc, char *argv[]) { char input[BUFSIZ]; int n; char *labelPtr; int zeroCount=0; int oneCount=0; n=0; gets(input); while(input[n]) { labelPtr=&input[n]; printf("%d \n", *labelPtr); if (*labelPtr==0) { zeroCount++; } if(*labelPtr==1) { oneCount++; } n++; } printf("The number of characters is %d \n", n); printf("The number of zeros is %d \n", zeroCount); printf("The number of ones is %d \n", oneCount); } 语法不正确。也没有第6个($ 5指的是架构中的第6个字段,位置符号从$ 0开始)字段有&#34; false&#34;在它中。使用正确的字段和正确的语法。假设第6个字段有&#34; false&#34;在其中,这就是你将如何应用过滤器。

matches