当前位置: 首页 > 知识库问答 >
问题:

Apache Pig-说明命令错误

缑桐
2023-03-14
]$ cat webccess.txt
mark,yahoo.com,6
sam,google.com,7
john,yahoo.com,3
patrick,cnn.com,8
mary,facebook.com,1
mark,yahoo.com,4
john,bbc.com,10
andrew,twitter.com,3
patrick,twitter.com,9

我正在Cloudera Quick Vm Hue Pig Shell(Grunt)中运行以下任务

grunt> stage1 = LOAD '/user/cloudera/webaccess.txt' USING PigStorage(',') AS (name:chararray, website:chararray, access:int);
grunt> DUMP stage1;
grunt> stage2 = FILTER stage1 by access >= 8;
grunt> stage3 = GROUP stage1 by name;
grunt> stage4 = FOREACH stage3 GENERATE group as GROUPS, MAX(stage1.access);
grunt> DUMP stage4;

输出:

(sam,7)
(john,10)
(mark,6)
(mary,1)
(andrew,3)
(patrick,9)

在这之前,一切都很好。

当我在关系阶段4上应用EXPLAYE命令进行查看时,我得到如下所示的错误,

grunt> ILLUSTRATE stage4;

2014-10-07 04:02:43,639 [main] WARN org.apache.hadoop.conf.Configuration - fs.default.name is deprecated. Instead, use fs.defaultFS
2014-10-07 04:02:43,642 [main] INFO org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to hadoop file system at: hdfs://localhost.localdomain:8020
2014-10-07 04:02:43,643 [main] WARN org.apache.hadoop.conf.Configuration - io.bytes.per.checksum is deprecated. Instead, use dfs.bytes-per-checksum
2014-10-07 04:02:43,643 [main] WARN org.apache.hadoop.conf.Configuration - dfs.https.address is deprecated. Instead, use dfs.namenode.https-address
2014-10-07 04:02:43,643 [main] INFO org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to map-reduce job tracker at: localhost.localdomain:8021
2014-10-07 04:02:43,799 [main] INFO org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MRCompiler - File concatenation threshold: 100 optimistic? false
2014-10-07 04:02:43,800 [main] INFO org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MultiQueryOptimizer - MR plan size before optimization: 1
2014-10-07 04:02:43,800 [main] INFO org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MultiQueryOptimizer - MR plan size after optimization: 1
2014-10-07 04:02:43,804 [main] INFO org.apache.pig.tools.pigstats.ScriptState - Pig script settings are added to the job
2014-10-07 04:02:43,805 [main] ERROR org.apache.pig.pen.ExampleGenerator - Error reading data. Internal error creating job configuration.
java.lang.RuntimeException: Internal error creating job configuration.
at org.apache.pig.pen.ExampleGenerator.getExamples(ExampleGenerator.java:160)
at org.apache.pig.PigServer.getExamples(PigServer.java:1182)
at org.apache.pig.tools.grunt.GruntParser.processIllustrate(GruntParser.java:739)
at org.apache.pig.tools.pigscript.parser.PigScriptParser.Illustrate(PigScriptParser.java:626)
at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:323)
at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:194)
at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:170)
at org.apache.pig.tools.grunt.Grunt.run(Grunt.java:69)
at org.apache.pig.Main.run(Main.java:538)
at org.apache.pig.Main.main(Main.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.util.RunJar.main(RunJar.java:208)
2014-10-07 04:02:43,868 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 2997: Encountered IOException. Exception
Details at logfile: /dev/null

我在学习阶段,由于这个错误,我不能进入下一个主题。

同样在我第一次打开Hue清管器外壳(Grunt)开始这个任务之前,我发现了以下警告。

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/util/PlatformName
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.util.PlatformName
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.apache.hadoop.util.PlatformName. Program will exit.
which: no hadoop in ((null))
which: no /usr/lib/hadoop/bin/hadoop in ((null))
dirname: missing operand
Try `dirname --help' for more information.
2014-10-07 03:18:27,802 [main] INFO org.apache.pig.Main - Apache Pig version 0.11.0-cdh4.7.0 (rexported) compiled May 28 2014, 11:05:48
2014-10-07 03:18:27,803 [main] INFO org.apache.pig.Main - Logging error messages to: /dev/null
2014-10-07 03:18:28,758 [main] INFO org.apache.pig.impl.util.Utils - Default bootup file /home/cloudera/.pigbootup not found
2014-10-07 03:18:30,436 [main] WARN org.apache.hadoop.conf.Configuration - fs.default.name is deprecated. Instead, use fs.defaultFS
2014-10-07 03:18:30,444 [main] INFO org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to hadoop file system at: hdfs://localhost.localdomain:8020
2014-10-07 03:18:37,832 [main] INFO org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to map-reduce job tracker at: localhost.localdomain:8021
2014-10-07 03:18:37,842 [main] WARN org.apache.hadoop.conf.Configuration - fs.default.name is deprecated. Instead, use fs.defaultFS

共有2个答案

微生善
2023-03-14

似乎是类路径问题。请检查是否在类路径中指定了所有必需的JAR。请检查此线程以了解更多详细信息

楚宪
2023-03-14

我没有遇到任何问题,说明命令工作正常。你能先在本地模式下执行吗?

    $pig -x local
    grunt> stage1 = LOAD 'input.txt' USING PigStorage(',') AS (name:chararray, website:chararray, access:int);
    grunt> stage2 = FILTER stage1 by access >= 8;
    grunt> stage3 = GROUP stage1 by name;
    grunt> stage4 = FOREACH stage3 GENERATE group as GROUPS, MAX(stage1.access);
    grunt> DUMP stage4;
    (sam,7)
    (john,10)
    (mark,6)
    (mary,1)
    (andrew,3)
    (patrick,9)
    grunt> ILLUSTRATE stage4;
    ----------------------------------------------------------------------------
    | stage1     | name:chararray     | website:chararray     | access:int     | 
    ----------------------------------------------------------------------------
    |            | john               | yahoo.com             | 3              | 
    |            | john               | bbc.com               | 10             | 
    ----------------------------------------------------------------------------
    --------------------------------------------------------------------------------------------------------------------------
    | stage3     | group:chararray     | stage1:bag{:tuple(name:chararray,website:chararray,access:int)}                     | 
    --------------------------------------------------------------------------------------------------------------------------
    |            | john                | {(john, yahoo.com, 3), (john, bbc.com, 10)}                                         | 
    |            | john                | {(john, yahoo.com, 3), (john, bbc.com, 10)}                                         | 
    --------------------------------------------------------------------------------------------------------------------------
    ------------------------------------------------
    | stage4     | GROUPS:chararray     | :int     | 
    ------------------------------------------------
    |            | john                 | 10       | 
    ------------------------------------------------
 类似资料:
  • Compose 命令说明 命令对象与格式 对于 Compose 来说,大部分命令的对象既可以是项目本身,也可以指定为项目中的服务或者容器。如果没有特别的说明,命令对象将是项目,这意味着项目中所有的服务都会受到命令影响。 执行 docker-compose [COMMAND] --help 或者 docker-compose help [COMMAND] 可以查看具体某个命令的使用格式。 docke

  • 我正在学习Java中的Ant脚本,阅读以下Hello World教程:http://Ant.apache.org/manual/tutorial-helloWorldWithant.html 然后将以下简单代码放入:src\oata\helloworld.java: 现在通过以下shell语句对其进行编译: 我知道javac编译了无类,但这一行到底是怎么做呢? TNX 安德里亚

  • 本文向大家介绍Mongodb启动命令参数中文说明,包括了Mongodb启动命令参数中文说明的使用技巧和注意事项,需要的朋友参考一下 我们可以通过mongod --help查看mongod的所有参数说明,以下是各参数的中文解释。 基本配置 Replicaton 参数 主/从参数 Replica set(副本集)选项 Sharding(分片)选项 示例: 上述参数都可以写入 mongod.conf 配

  • 错误码当请求发生错误时,服务器会返回错误码 ( code ) 和错误信息 ( msg ),完整的错误码如下表。 错误分为 客户端错误 和 服务器端错误 两种,如果是客户端错误,说明该错误是由用户提交的API引起的;如果是服务器端错误,说明该错误是由服务器端引起的。 客户端错误: 错误代码 错误类型 提示 1100 消息格式错误 当缺少必要参数,或者参数值格式不正确时,会返回该错误。此时可以查看相关

  • 接口错误码相关 错误返回示例 { "error": { "code": 2001, "message": "房间不存在", "type": "RoomNotExist" }, "errorMsg": "房间不存在", "result": "FAIL" } 错误码 错误码 错误说明 -1 系统错误 -2 依赖服务HTT

  • 本文向大家介绍Redis 命令整理并说明如何使用,包括了Redis 命令整理并说明如何使用的使用技巧和注意事项,需要的朋友参考一下 连接操作相关的命令 quit:关闭连接(connection) auth:简单密码认证 持久化 save:将数据同步保存到磁盘 bgsave:将数据异步保存到磁盘 lastsave:返回上次成功将数据保存到磁盘的Unix时戳 shundown:将数据同步保存到磁盘,然