Re: how to call udf with parameters

2017-06-15 Thread Pralabh Kumar
sample UDF val getlength=udf((data:String)=>data.length()) data.select(getlength(data("col1"))) On Fri, Jun 16, 2017 at 9:21 AM, lk_spark wrote: > hi,all > I define a udf with multiple parameters ,but I don't know how to > call it with DataFrame > > UDF: > > def ssplit2 = udf { (sentence:

Re: how to call udf with parameters

2017-06-18 Thread Yong Zhang
ataset.select(len($"text").as('length)).show +--+ |length| +--+ | true| | true| +--+ Yong From: Pralabh Kumar Sent: Friday, June 16, 2017 12:19 AM To: lk_spark Cc: user.spark Subject: Re: how to call udf with parameters sample UDF val getlengt

Re: Re: how to call udf with parameters

2017-06-15 Thread lk_spark
-06-16 17:49 主题:Re: how to call udf with parameters 收件人:"lk_spark" 抄送:"user.spark" sample UDF val getlength=udf((data:String)=>data.length()) data.select(getlength(data("col1"))) On Fri, Jun 16, 2017 at 9:21 AM, lk_spark wrote: hi,all I define a udf with

Re: Re: how to call udf with parameters

2017-06-15 Thread Pralabh Kumar
try it with errors. Does the udf parameters could only > be a column type? > > 2017-06-16 > -- > lk_spark > -- > > *发件人:*Pralabh Kumar > *发送时间:*2017-06-16 17:49 > *主题:*Re: how to call udf with parameters >

Re: Re: how to call udf with parameters

2017-06-15 Thread Pralabh Kumar
arameters could only >> be a column type? >> >> 2017-06-16 >> -- >> lk_spark >> ------------------ >> >> *发件人:*Pralabh Kumar >> *发送时间:*2017-06-16 17:49 >> *主题:*Re: how to call udf with parameters >> *收件人:*"lk_sp

Re: Re: Re: how to call udf with parameters

2017-06-15 Thread lk_spark
thanks Kumar , that really helpful !! 2017-06-16 lk_spark 发件人:Pralabh Kumar 发送时间:2017-06-16 18:30 主题:Re: Re: how to call udf with parameters 收件人:"lk_spark" 抄送:"user.spark" val getlength=udf((idx1:Int,idx2:Int, data : String)=> data.substring(idx1,idx2)) data