Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spark sql current timestamp function

Is there a sql fucntion in spark sql which returns back current timestamp , example in impala NOW() is the function which returns back current timestamp is there similar in spark sql ?

Thanks

like image 718
sri hari kali charan Tummala Avatar asked Dec 07 '15 14:12

sri hari kali charan Tummala


People also ask

How do I get the current date in Spark SQL?

current_date. current_date() - Returns the current date at the start of query evaluation.

How do you add a timestamp in Spark?

Since Spark doesn't have any functions to add units to the Timestamp, we use INTERVAL to do our job. Before we apply INTERVAL, first you need to convert timestamp column from string to TimestampType using cast. Here, first, we create a temporary table using createOrReplaceTempView() and then use this on SQL select.

How do you use timestamp in PySpark?

Introduction to PySpark TimeStamp. PySpark TIMESTAMP is a python function that is used to convert string function to TimeStamp function. This time stamp function is a format function which is of the type MM – DD – YYYY HH :mm: ss. sss, this denotes the Month, Date, and Hour denoted by the hour, month, and seconds.


1 Answers

Try current_timestamp function.

current_timestamp() - Returns the current timestamp at the start of query evaluation. All calls of current_timestamp within the same query return the same value. 
like image 102
Kaushal Avatar answered Sep 21 '22 18:09

Kaushal