Hive UDF处理Scala中的整数数组

时间:2016-06-21 18:19:23

标签: scala hadoop apache-spark hive udf

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

我试过了:

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中使用哪种类型来处理Hive中的数组列?

1 个答案:

答案 0 :(得分:0)

经过一些研究后,我找到了具体的课程:

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