gpt4 book ai didi

apache-pig - 如何将 1x1 别名转换为标量?

转载 作者:行者123 更新时间:2023-12-01 11:41:13 25 4
gpt4 key购买 nike

我想将计数转化为概率:

total = foreach (group A all) generate SUM(A.count);
A = foreach A generate A.count / total as probability;

这不起作用,因为 total 是别名,而不是标量:

Invalid scalar projection: total : A column needs to be projected from a relation for it to be used as a scalar

最佳答案

即使别名 total 只有一个字段(总和),您仍然必须引用该字段。

这应该有效:

total = foreach (group A all) generate SUM(A.count) as total;
A = foreach A generate A.count / total.total as probability;

关于apache-pig - 如何将 1x1 别名转换为标量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20528350/

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