gpt4 book ai didi

apache-pig - 无法将 org.apache.pig.builtin.SUM 的匹配函数推断为多个或都不适合。请使用显式转换

转载 作者:可可西里 更新时间:2023-11-01 15:30:41 26 4
gpt4 key购买 nike

我想对包含长类型数字的列求和。我尝试了很多可能的方法,但仍然没有解决转换错误。

我的 pig 代码:

raw_ds = LOAD '/tmp/bimallik/data/part-r-00098' using PigStorage(',')  AS (
d1:chararray, d2:chararray, d3:chararray, d4:chararray, d5:chararray,
d6:chararray, d7:chararray, d8:chararray, d9:chararray );

parsed_ds = FOREACH raw_ds GENERATE d8 as inBytes:long, d9 as outBytes:long;

X = FOREACH parsed_ds GENERATE (long)SUM(parsed_ds.inBytes) AS inBytes;
dump X;

错误快照:

2015-11-20 02:16:26,631 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1045: Could not infer the matching function for org.apache.pig.builtin.SUM as multiple or none of them fit. Please use an explicit cast. Details at logfile: /users/bimallik/pig_1448014584395.log 2015-11-20 02:17:03,629 [main] INFO org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - 50% complet

最佳答案

@ManjunathBallur 感谢您的输入。我现在更改了我的代码如下

<..same as before ...>
A = GROUP parsed_ds by inBytes;
X = FOREACH A GENERATE SUM(parsed_ds.inBytes) as h;
DUMP X;

现在 A 正在生成一包常见的 inBytes,X 给出每个包的 inBytes 总和的总和,它再次由多行组成,因为我需要一个单一的总和值。

关于apache-pig - 无法将 org.apache.pig.builtin.SUM 的匹配函数推断为多个或都不适合。请使用显式转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33824389/

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