日期列和其他日期之间的区别

时间:2019-04-03 16:07:38

标签: scala apache-spark

我想找到spark数据集中的Date列与非列的日期值之间的区别。

如果两者都属于我列

datediff(col(“ dateStart”),col(“ dateEnd”)

我要查找col(“ dateStart”)和另一个不是列的日期之间的区别

val dsWithTimeDiff = detailRecordsDs.withColumn(RunDate,                      lit(runDate.toString))

val dsWithTimeDiff = dsWithRunDate.withColumn(DateDiff,
  datediff(to_date(col(RunDate)), col(DateCol)))

有没有更好的方法,而不是再添加一列然后找到区别

0 个答案:

没有答案