我是新来的Hive。我在编写hiveudf时遇到了麻烦,在这里我将3个参数作为3列传递给udf。我需要构造3个列的值列表。在此基础上,我将对3个列表执行逻辑,并为每条记录返回一个字符串。
我的代码必须是这样的。
public String evaluate(int column1, int column2, String column3){
ArryList column1List //column1List has to all column1 values
ArryList column2List //column2List has to all column2 values
ArryList column3List //column3List has to all column3 values
}
有人能帮我一下吗。
1条答案
按热度按时间cs7cruho1#
如果我正确地解释了你的意图,你可以用hive的内置函数来实现
collect_list
. 例如:这将集合在
field1
列my_table
.根据您需要对这些列表做什么,您可能会发现简单地传递
collect_list
到您的自定义项(因为它们已经是列表)。更多文档请参见:
https://cwiki.apache.org/confluence/display/hive/languagemanual+udf