gpt4 book ai didi

hadoop - PIG : Unable to open iterator for alias AliasName. 标量在输出中有多于一行

转载 作者:可可西里 更新时间:2023-11-01 15:28:31 27 4
gpt4 key购买 nike

我是 pig 的新手,正在尝试自学。

我编写了一个脚本来获取从 words.txt 文件中读取的单词的纪元时间。

这是脚本。

words = LOAD 'words.txt' AS word:chararray;
B = FOREACH A GENERATE CONCAT(CONCAT(A.word,'_'),(chararray)ToUnixTime(CurrentTime());
dump B;

但问题是,如果 words.txt 文件只有一个单词,它会给出正确的输出。

如果它有多个词,比如

word1
word2
word3
word4

然后它给出了以下错误

ERROR 1066: Unable to open iterator for alias B

java.lang.Exception: org.apache.pig.backend.executionengine.ExecException: ERROR 0: Scalar has more than one row in the output. 1st : (word1 ), 2nd :(word2) (common cause: "JOIN" then "FOREACH ... GENERATE foo.bar" should be "foo::bar" ) at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462) at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:522) Caused by: org.apache.pig.backend.executionengine.ExecException: ERROR 0: Scalar has more than one row in the output. 1st : (word1 ), 2nd :(word2) (common cause: "JOIN" then "FOREACH ... GENERATE foo.bar" should be "foo::bar" ) at org.apache.pig.impl.builtin.ReadScalars.exec(ReadScalars.java:122) at o

请建议我解决这个问题。

谢谢。

最佳答案

我自己解决了。刚刚从内部 CONCAT 中删除了 A.。它对我有用。

脚本:

words = LOAD 'words.txt' AS word:chararray;
B = FOREACH A GENERATE CONCAT(CONCAT(word,'_'),(chararray)ToUnixTime(CurrentTime());
dump B;

关于hadoop - PIG : Unable to open iterator for alias AliasName. 标量在输出中有多于一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39343264/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com