You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by sudhir k <k....@gmail.com> on 2017/06/30 16:50:41 UTC

Withcolumn date with sysdate

Can we add a column to dataframe with a default value like sysdate .. I am
calling my udf but it is throwing error col expected .

On spark shell
df.withcolumn("date",curent_date) works I need similiar for scala program
which I can build in a jar


Thanks,
Sudhir
-- 
Sent from Gmail Mobile

Re: Withcolumn date with sysdate

Posted by Pralabh Kumar <pr...@gmail.com>.
put default value inside lit

df.withcolumn("date",lit("constant value"))

On Fri, Jun 30, 2017 at 10:20 PM, sudhir k <k....@gmail.com> wrote:

> Can we add a column to dataframe with a default value like sysdate .. I am
> calling my udf but it is throwing error col expected .
>
> On spark shell
> df.withcolumn("date",curent_date) works I need similiar for scala program
> which I can build in a jar
>
>
> Thanks,
> Sudhir
> --
> Sent from Gmail Mobile
>