我正在测试apache pig docs中的以下示例:
http://pig.apache.org/docs/r0.14.0/basic.html#order-由
但排序功能似乎不起作用。你知道吗?
$ pig -version
Apache Pig version 0.14.0 (r1640057)
compiled Nov 16 2014, 18:02:05
grunt> a= load 'data' as (c1:int, c2:int, c3:int);
grunt> describe a;
a: {c1: int,c2: int,c3: int}
grunt> dump a;
(1,2,3)
(4,2,1)
(8,3,4)
(4,3,3)
(7,2,5)
(8,4,3)
grunt> result = order a by c1 desc;
grunt> dump result;
(8,4,3)
(8,3,4)
(4,3,3)
(4,2,1)
(1,2,3)
(7,2,5)
grunt> result = order a by c2 desc;
grunt> dump result;
(8,4,3)
(7,2,5)
(4,2,1)
(1,2,3)
(4,3,3)
(8,3,4)
grunt> result = order a by c3 desc;
grunt> dump result;
(7,2,5)
(4,3,3)
(8,4,3)
(1,2,3)
(4,2,1)
(8,3,4)
1条答案
按热度按时间8dtrkrch1#
您正在使用默认分隔符加载数据(
tab
)但实际输入的数据并没有正确地用tab分隔。您能确保您的输入数据字段是由文件中的制表符分隔的吗'data'
.在下面的示例中,每个输入字段由制表符及其工作区分隔。