【发布时间】:2023-02-13 13:58:50
【问题描述】:
自 1/1/1970 以来,Dataframe 有超过 100 亿条记录,时间以 bigint 形式存储,以毫秒为单位。我需要它作为日期 - 如下所示应用转换。有更快的方法吗?
spark.createDataFrame([[1365742800000],[1366866000000]], schema=["origdt"])\
.withColumn("newdt", F.to_date((F.col("origdt")/1000).cast(TimestampType()))).show()
【问题讨论】:
标签: apache-spark pyspark