現在の時刻
クエリ評価の開始時の現在の時刻を TimeType 列として返します。同じクエリ内での current_time のすべての呼び出しは同じ値を返します。
構文
Python
from pyspark.databricks.sql import functions as dbf
dbf.current_time(precision=<precision>)
パラメーター
パラメーター | Type | 説明 |
|---|---|---|
|
| [0..6] の範囲の数値で、秒の小数点以下の桁数を示します。省略した場合、デフォルトは 6 です。 |
戻り値
pyspark.sql.Column: 現在の時刻。
例
例1 : デフォルトの精度での現在の時刻
Python
from pyspark.databricks.sql import functions as dbf
spark.range(1).select(dbf.current_time().alias("time")).show()
Output
+---------------+
| time|
+---------------+
|16:57:04.304361|
+---------------+
例2 : 指定された精度での現在の時刻
Python
from pyspark.databricks.sql import functions as dbf
spark.range(1).select(dbf.current_time(3).alias("time")).show()
Output
+------------+
| time|
+------------+
|16:57:04.304|
+------------+