2016-06-21 179 views
1

我是scala中的新手,我需要编写用户定义的函数来处理Hive中的整数数组列(类型array<int>)。Hive UDF处理Scala中的整数数组

我已经试过:

import org.apache.hadoop.hive.ql.exec.UDF 

class testUDF extends UDF { 

    def evaluate(arr: Array[Int], txt: String): Boolean = { 
    return false 
    } 

} 

但是,当我试图把它调用SQL我得到错误:

No matching method for class ... with (array<int>, string). Possible choices: _FUNC_(struct<>, string) 

我需要什么类型在Scala中使用与阵列列工作蜂巢?

+0

您将需要使用Hadoop的数据类型('writable') - http://hadooptutorial.info/hadoop-data-types/ –

回答

0

经过一番研究,我发现特定的类到案件:

import org.apache.hadoop.hive.ql.udf.generic.GenericUDF;