0
在火花1.4.1,callUdf方法的參數是java中,如何調用UDF在火花1.4.1
(String udfName, scala.collection.Seq<Column> cols)
沒有方法,其可在1.5.1作用以直接列,類似方法
callUDF(String udfName, Column col)
那麼如何在1.4.1中調用UDF呢?或如何改變列類型
scala.collection.Seq<Column>
例如,這些代碼在1.6.1
sqlContext.udf().register("stringToLong", new UDF1<String, Long>() {
@Override
public Long call(String arg0) throws Exception {
// TODO Auto-generated method stub
IPTypeConvert itc = new IPTypeConvert();
return itc.stringtoLong(arg0);
}
}, DataTypes.LongType);
DataFrame interDF = initInterDF.withColumn("interIPInt", callUDF("stringToLong", initInterDF.col("interIP")));
工作,我應該如何改變代碼,使他們能夠在火花1.4.1工作?
原諒我,我是菜鳥。非常感謝你! – volity
@volity放鬆:)我很高興我幫你:) –