0

我正在使用 Hortonworks Sandbox 1.2,而且我对 Hadoop 平台还很陌生。

所以这是错误,而我正在按照沙盒包含的教程进行操作。在 PIG 部分,我使用 PIG Helper 插入了 GROUP 代码。它插入一个代码,如

GROUP %VAR% BY %VAR%

完成教程后,我的代码看起来像这样。

a = LOAD 'nyse_stocks' USING org.apache.hcatalog.pig.HCatLoader();
b = FILTER a BY stock_symbol == 'IBM';
c = GROUP b BY all;
d = FOREACH c GENERATE AVG(b.stock_volume);
DUMP d;

它在下面给出错误:

[main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: mismatched input ';' expecting LEFT_PAREN

我按照教程中的说明做所有事情。那么错误在哪里呢?

编辑:我在下面添加了 PIG 日志。

2013-06-24 04:56:16,869 [main] INFO org.apache.pig.Main - Apache Pig version 0.10.1.21 (rexported) compiled Dec 24 2012, 03:01:24
2013-06-24 04:56:16,870 [main] INFO org.apache.pig.Main - Logging error messages to: /hadoop/mapred/taskTracker/sandbox/jobcache/job_201306240450_0001/attempt_201306240450_0001_m_000000_0/work/pig_1372064176867.log
2013-06-24 04:56:20,224 [main] INFO org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to hadoop file system at: hdfs://sandbox:8020
2013-06-24 04:56:22,862 [main] INFO org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to map-reduce job tracker at: sandbox:50300
2013-06-24 04:56:25,672 [main] WARN org.apache.hadoop.hive.conf.HiveConf - DEPRECATED: Configuration property hive.metastore.local no longer has any effect. Make sure to provide a valid value for hive.metastore.uris if you are connecting to a remote metastore.
2013-06-24 04:56:25,959 [main] INFO hive.metastore - Trying to connect to metastore with URI thrift://sandbox:9083
2013-06-24 04:56:27,956 [main] INFO hive.metastore - Waiting 1 seconds before next connection attempt.
2013-06-24 04:56:28,957 [main] INFO hive.metastore - Connected to metastore.
2013-06-24 04:56:30,552 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: mismatched input ';' expecting LEFT_PAREN
Details at logfile: /hadoop/mapred/taskTracker/sandbox/jobcache/job_201306240450_0001/attempt_201306240450_0001_m_000000
4

2 回答 2

2
c = GROUP b BY all; 

不正确,正确的语法是

c = GROUP b all;
于 2014-08-10T04:35:24.540 回答
0

按照这个链接看第4步,那里提到的例子解释了在pig中执行“Group”的正确方法

链接:(http://hortonworks.com/hadoop-tutorial/hello-world-an-introduction-to-hadoop-hcatalog-hive-and-pig/#pig

于 2014-06-04T05:52:16.053 回答