spark unix_timestamp data type mismatch -


could guide me in data type or format need submit from_unixtime spark from_unixtime() function work?

when try following works, responds not current_timestamp.

from_unixtime(current_timestamp()) 

the response below:

fromunixtime(currenttimestamp(),yyyy-mm-dd hh:mm:ss) 

when try input

from_unixtime(1392394861,"yyyy-mm-dd hh:mm:ss.ssss") 

the above fails type mismatch:

error: type mismatch; found : int(1392394861) required: org.apache.spark.sql.column from_unixtime(1392394861,"yyyy-mm-dd hh:mm:ss.ssss")

what missing? i've tried number of different things , tried reading documentation on using date/time in spark , every example i've tried fails type mismatches.

use lit() create column of literal value, this:

from_unixtime(lit(1392394861), "yyyy-mm-dd hh:mm:ss.ssss") 

or, zero323 mentioned:

from_unixtime(current_timestamp().cast("long"))  

Comments