If you have the temp view name (table, for example), couldn't you do something like this?
val dfWithColumn=spark.sql("select *, <your_new_column> as new_column from table") Thanks, Subhash On Thu, Feb 1, 2018 at 11:18 AM, kant kodali <kanth...@gmail.com> wrote: > Hi, > > Are you talking about df.withColumn() ? If so, thats not what I meant. I > meant creating a new column using raw sql. otherwords say I dont have a > dataframe I only have the view name from df.createOrReplaceView("table") > so I can do things like "select * from table" so in a similar fashion I > want to see how I can create a new Column using the raw sql. I am looking > at this reference https://docs.databricks.com/spark/latest/ > spark-sql/index.html and I am not seeing a way. > > Thanks! > > On Thu, Feb 1, 2018 at 4:01 AM, Jean Georges Perrin <j...@jgp.net> wrote: > >> Sure, use withColumn()... >> >> jg >> >> >> > On Feb 1, 2018, at 05:50, kant kodali <kanth...@gmail.com> wrote: >> > >> > Hi All, >> > >> > Is there any way to create a new timeuuid column of a existing >> dataframe using raw sql? you can assume that there is a timeuuid udf >> function if that helps. >> > >> > Thanks! >> >> >