suppose having data frame
+--------------------+---------------+------+ | timestamp| login | age | +--------------------+---------------+------+ 2016-06-01 01:05:20 | 7372 | 50| 2016-06-01 01:00:20 | 7374 | 35| 2016-06-01 01:10:20 | 7376 | 40|
i want records between 1 1:10 time irrespective of date and
the time in unix_timestamp "yyyy-mm-dd hh:mm:ss"
how extract records please helpme.
this analyze people coming late :)
thank in advance.
you try using functions hour
, minute
of functions package:
import org.apache.spark.sql.functions._ import org.apache.spark.sql.types._ val tscol = col("timestamp").cast(timestamptype) val filtereddf = df.filter( (hour(tscol) === 1) && (minute(tscol).between(0, 10)) )
Comments
Post a Comment