【发布时间】:2016-06-28 02:21:05
【问题描述】:
我正在尝试根据同一数据帧的其他列向给定数据帧添加一个新列。
map 是一个字符串布尔映射
下面是我的代码。
hiveContext.udf().register("udfname", new UDF2<String, String, Boolean>() {
@Override
public Boolean call(String col1, String col2) throws Exception {
return map.get(col1+col2);
}
}, DataTypes.BooleanType);
DataFrame newDF = df.withColumn("newcol", calUDF("udfname" ,df.col("col1"),df.col("col2")));
我收到编译错误。
The method calUDF(String, Column, Column) is undefined for the type myclass
【问题讨论】:
标签: java apache-spark spark-dataframe udf